How to check if the file does not exist in Bash
To check, if a file doesn’t exist in the bash we need to use not !
logical operator in the test
command.
if [ ! -f /tmp/songs.txt ]; then
echo "File not found!"
fi
-f is used to check if a regular file exists.