1

Can anyone tell the equivalent command for ksh on AIX or do I have to calculate a rwxrwxrwx value into 777 by using a script?

2

AIX has an istat command that gives you the same kind of information as GNU stat does, but not in any arbitrary format.

In particular, you can't get the permissions as an octal number directly.

I'm not aware that AIX has dedicated command for that. You can always do it in perl:

perl -e '@s = stat shift or die "stat: $!\n";
         printf "%o\n", $s[2] & 07777' -- your-file

See Convert ls -l output format to chmod format for more details including a way to convert the rwxrwxrwx format to octal.

The above gives you the permissions after symlink resolution. If for symlinks, you want the permissions of the link instead (not very useful as that's always 777), replace stat with lstat.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.