How might I reliably get the owner of a file in AIX? By reliable, I don't want to parse the output of ls
. On Linux, I would just do a stat --printf=%U foo
, but I'm working on AIX 6.1 and 7.1. I know I can do istat
, but as there is no --printf
option on AIX istat
, I would still have to munge the output with grep
and awk
, therefore not as desirable. In other words, how can I emulate Linux's stat --printf=%U foo
using only AIX's core utils?
AIX – How to Get File Owner Without Munging ls Output
aixfilesstat
Best Answer
This is a script I wrote a while ago, in order to get a stat(1)-like utility in AIX. Just added %U! I found it more useful to use the -c option, which behaves slightly differently from --printf. Includes a handy-dandy local copy of perl's stat array as a comment block.