Wednesday, November 5, 2008

Expressions of if

Comparisons:
-eq equal to
-ne not equal to
-lt less than
-le less than or equal to
-gt greater than
-ge greater than or equal to

File Operations:
-s file exists and is not empty
-f file exists and is not a directory
-d directory exists
-x file is executable
-w file is writable
-r file is readable

Others:
[ -n "$var" ] : Test if the variable $var contains something
-z test for zero length of a string

No comments: