To list file permission/access right in octal format, linux has a command 'stat'. For example, we can use the followin -
stat -c %a `find . -type f
Is there any equivalent command in AIX and HP-UX to give the same result as linux 'stat' command?
Please advice.
did you check this for is there or not.
/usr/bin/istat
ygemici
4
you can use this instead of perl
#!/bin/bash
## sunOS unix.com @ygemici ** find file/dir access rights in octal ##
## stat_justdoit ##
tmp_=/tmp/statics_unix.com_tmp
tmp_stats_=/tmp/stats_prmx_tmp_
if [ -f "$1" ]; then ls -v "$1">$tmp_
elif [ -d "$1" ]; then ls -dv "$1">$tmp_
else echo "Parameter must be regular file or directory!!";exit 1;fi
sed -n '/^ *[013]/s/.*::*\([^ ]*\).*/\1/p' $tmp_>$tmp_stats_
calc=`sed -n "$i s/-/0_X/g;s/r/4_X/g;s/w/2_X/g;s/x/1_X/g;s/_X/+/g;s/+$//p" $tmp_stats_|bc`
recalc=`echo $calc`;echo ${recalc// /}
# touch testfile
# ls -l testfile
-rw-r--r-- 1 root root 0 Jun 10 18:26 testfile
# ./stat_justdoit testfile
644
regards
ygemici