Often when writing for the bash shell, one needs to test if a file (or Directory) exists (or doesn\'t exist) and take appropriate action. Most common amongst these test are
You can use logical operators to multiple conditions, e.g. -a for AND:
-a
AND
MYFILE=/tmp/data.bin if [ -f "$MYFILE" -a -r "$MYFILE" -a -w "$MYFILE" ]; then #do stuff fi unset MYFILE