Tuesday, July 19, 2011

Test Objects (Files, Directories, etc.)

test "true" if:                 ksh
-----------------------------------
object exist                    -a
readable                        -r
writable                        -w
executable                      -x
non-zero length                 -s
zero length

directory                       -d
plain file                      -f
symbolic link                   -h
named pipe                      -p
block special file              -b
character special file          -c
soft link                       -L
socket                          -S

owned by me                     -O
owned by my group              not

"sticky" bit set                -k
set-group-ID bit set            -g
set-user-id bit set             -u

opened on a terminal           not