Tuesday, September 13, 2011

bash notes

http://tldp.org/LDP/abs/html/fto.html

if [ -<opt> "$str" ]
then
     ...
else
     ...
fi

-e exists
-f is a file
-s is not 0 bytes
-d is directory
-b is block device
-c is char device
-p is pipe
-b is symlink
-L is symlink
-S is socket
-t  is terminal
-r has read perm
-w has write
-x has execute
-g has sgid flag
-u has suid flag
-k sticky bit
-O owner
-G gid same as yours
-N modifed since last read
f1 -nt f2 f1 newer than f2
f1 -ot f2 f2 older than f2
! nots above compares

No comments:

Post a Comment