The test command ([
here) has a “not” logical operator which is the exclamation point (similar to many other languages). Try this:
if [ ! -f /tmp/foo.txt ]; then echo "File not found!" fi
The test command ([
here) has a “not” logical operator which is the exclamation point (similar to many other languages). Try this:
if [ ! -f /tmp/foo.txt ]; then echo "File not found!" fi