statfile
programstatfile -options file [command arg ...]
statfile
calls stat()
on file
, sets
the environment variables specified in options
according to the
stat
information, and runs command
. If
file
begins with a digit, it is interpreted as a file
descriptor, and passed to fstat()
. If command
is
not given, statfile exits zero, indicating that the stat()
call
was successful. The leading "-
" in the options
argument is not required. Options are as follows:
l
: call lstat()
instead of
stat()
d
: set $DEV
to the file's device number
i
: set $INO
to the file's inode number
t
: set $TYPE
to the file's type: -
for regular files
d
for directories
l
for symlinks
p
for fifos
s
for sockets
c
for character devices
b
for block devices
m
: set $MODE
to the file's
permissions, in octal, e.g.: 01777
. Also set each
of the following to 1
, or unset them, according to
whether that bit is set in the permissions: MODE_SUID
MODE_SGID
MODE_STICKY
MODE_RUSR
MODE_WUSR
MODE_XUSR
MODE_RGRP
MODE_WGRP
MODE_XGRP
MODE_ROTH
MODE_WOTH
MODE_XOTH
n
: set $NLINK
to the number of hard
links to the file
u
: set $UID
to the file owner's
uid
g
: set $GID
to the file group's
gid
r
: set $RDEV
to the file's rdev
number
s
: set $SIZE
to the file's size
S
: set $BLKSIZE
to the block size for
this file
b
: set $BLOCKS
to the number of blocks
for this file
A
: set $ATIME
to the file's last
access time, as a decimal time_t
value, and
$ATAI64N
to the corresponding TAI64N label, in
hex
M
: set $MTIME
to the file's last
modification time, as a decimal time_t
value, and
$MTAI64N
to the corresponding TAI64N label, in
hex
C
: set $CTIME
to the file's last inode
change time, as a decimal time_t
value, and
$CTAI64N
to the corresponding TAI64N label, in
hex