sajad torkamani

Check if file exists:

if [ -f /tmp/foo.txt ]; then
    echo "File found!"
fi

Check if file doesn’t exist:

if [ ! -f /tmp/foo.txt ]; then
    echo "File not found!"
fi