My code of shell script is as follows:
echo "Enter file name";
read fname;
if [-f$fname];
then
echo "File already exists";
fi`
However, when I run my script, I get this error:
[-ffile]: not found
I have tried spacing -f $fname
but I still get the same error.
Why is this happening and how can I fix it?
if [ -f $fname ];
is spaces are missing? – snoop Oct 19 '15 at 09:18