if test (expression)
if test !(expression)
if test expression1 -a expression2
if test expression1 -o expression2
if test -z STRING
if test STRING1 = STRING2
if test STRING1 != STRING2
if test INTEGER1 -eq INTEGER2
if test INTEGER1 -ge INTEGER2
if test INTEGER1 -gt INTEGER2
if test INTEGER1 -lt INTEGER2
if test INTEGER1 -le INTEGER2
if test INTEGER1 -ne INTEGER2
if test file1 -nt file2 # -nt :- newer than
if test file1 -ot file2 # -ot :- older than
if test -f file # if file exists
if test -d directory_name # if directory exists
if test -x file # if file is executable
if test -r file # if file is readable
if test -w file # if file is writable
if test -s "filename.txt"; then
# Code to execute if the file is not empty
else
# Code to execute if the file is empty or does not exist
fi
No comments:
Post a Comment