Test if file or directory exists
https://www.tldp.org/LDP/abs/html/fto.html
Check if regular file exists:
if [ -f "/path/to/file" ]
then
echo "Exists";
fi
Check if not regular file (or does not exist):
if [ ! -f "/path/to/file" ]
then
echo "Not file";
fi
Check if file is a directory:
if [ -d "/path/to/dir" ]
then
echo "Exists";
fi
Check if file is not a directory (or does not exist):
if [ ! -d "/path/to/dir" ]
then
echo "Not directory";
fi