|
Checking the existence of a file..
Hi,
I am trying to check for the existence of a file using the 'test' and the file existence options.
When trying to check for a file with a space in between e.g 'Team List', it gives the following error.
learn1: line 3: test: `Team: binary operator expected
I am pasting my code below as well:
echo "Please enter a file name"
read fname
if test -f $fname
then
echo "$fname exists"
else
echo "$fname doesnot exist"
fi
Can someone help me with this...
Regards,
Indra
|