Follow these steps: if [ -f test ]; then echo "exists!" else echo "missing!" fi if [ -f test ]; then echo "exists!" else echo "missing!" fi