Wednesday, July 18, 2012

Script to list permission of all directories in given path

I got a task to list all permissions of all directories in the give path , there were arround ( very long )80 paths.
wrote below for loop and it's become very easy :)

Script to list permission of all directories in given path.

# cat perm.sh
cd /
for i in `echo $1|sed "s/\// /g"`
do
ls -ld $i
cd $i
done

# ./perm.sh /opt/Tivoli/DM/slam
drwxr-xr-x   26 root     system         4096 Aug 18 2011  opt
drwxr-xr-x    9 root     system          256 Mar 19 2010  Tivoli
drwxr-xr-x   11 root     system         4096 Aug  5 2010  DM
drwxr-xr-x    2 root     system          256 Nov 24 2009  slam
#
 

No comments:

Popular Posts

Is this site helping you ?