if [ ! condition ] | If condition is not true |
if [ -f $FILENAME ] | If file exists called $FILENAME |
if [ -d $DIRNAME ] | If directory exists called $DIRNAME |
if [ -x $FILENAME ] | if file $FILENAME is executable |
if [ -w $FILENAME ] | if file $FILENAME is writable |
if [ -r $FILENAME ] | if file $FILENAME is readable |
if [ -s $FILENAME ] | if file $FILENAME exists and is of greater than zero size. |
if [ $VAR1 -ne $VAR2 ] | If VAR1 does not equal VAR2 |
if [ $VAR1 -gt $VAR2 ] | If VAR1 is greater than VAR2 |
if [ $VAR1 -lt $VAR2 ] | If VAR1 is less than VAR2 |
if [ $VAR1 -eq $VAR2 ] | If VAR1 is equal to VAR2 |
if [ $VAR1 -ge $VAR2 ] | if VAR1 is greater than or equal to VAR2 |
if [ $VAR1 -le $VAR2 ] | if VAR1 is less than or equal to VAR2 |
if [ "$VAR1" = "$VAR2" ] | If VAR1 is equal to VAR2 (for strings) |
if [ "$VAR1" != "$VAR2" ] | If VAR1 does not equal VAR2 (strings) |
if [ ! "$VAR1" ] | If VAR1 is null |
if [ "$VAR1" ] | if VAR1 is not null |