I'm looking for a way to check if a filename exists inside a bash file:
Code: Select all
filename= "some file.txt"
if [ -e $filename ]
then
somefunction
else
echo " "; echo "ERROR: File not found! Returning..."; sleep 2;
fi
Code: Select all
filetool.sh: 79: [: some: unexpected operator
Any help appreciated.