"ls -ld" on all nodes in the path

Haven't you run into a situation when a certain user cannot access the file somewhere deep down and you don't know what directory the permission is not given? You can "ls -ld" repeatedly but it's time consuming.

Since I couldn't come up with good search term to google, I rolled my own bash alias.

I vaguely remember there's a special command or {Solaris|GNU} ls option for doing equivalent. Can anyone kindly tell me?
bash-3.00# declare -f lsallnodes 
lsallnodes ()
{
    i=1;
    all=$1;
    while true; do
        node=$(echo $1 | /usr/xpg4/bin/sed 's|\\(/\\{1,\\}[\^/]\*\\)\\{'$i'\\}$||');
        if [ -z $node ]; then
            break;
        fi;
        i=$((i+1));
        all=$all" "$node;
    done;
    ls -ld $all
}
bash-3.00# lsallnodes "/mnt/bipshare/MIS/OS/Solaris////Solaris_2.8/CDs/ja_x86_2.8.iso"
drwxr-xr-x   4 root     sys          512 Nov 20  2007 /mnt
drwxr-xr-x  19 root     root        4096 May  2  2006 /mnt/bipshare
drwxrwx---  18 user1001 bipadmin    4096 Feb 26  1970 /mnt/bipshare/MIS
drwxrwx---   3 1008     support     4096 May  4  2006 /mnt/bipshare/MIS/OS
drwxrwx---  10 1008     support     4096 May  4  2006 /mnt/bipshare/MIS/OS/Solaris
drwxrwx---   6 1008     support     4096 May  4  2006 /mnt/bipshare/MIS/OS/Solaris////Solaris_2.8
drwxrwx---   2 1008     support     4096 May  4  2006 /mnt/bipshare/MIS/OS/Solaris////Solaris_2.8/CDs
-rwxrwx---   1 1008     support  625664000 May 20  2005 /mnt/bipshare/MIS/OS/Solaris////Solaris_2.8/CDs/ja_x86_2.8.iso
Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today