I am having a lot of trouble using a command line argument in a script file to check if a file is being entered in the command line. So basically I have a script file named ./file and a logfile named log. I have an if then else statement to run a check to see if the right file is entered and if not the program exits with an echo error. If the right file name is entered then it continues to run script. I either get an error directory or file doesn't exist or my echo error no matter what I do. Can someone please point out what I'm doing wrong? Thank you for any help provided. I am using putty. this is what I have
if ["./file log"]
then
echo ""
else
echo "error"
exit 0
fi
$ ./file log
, i.e. withlog
as the argument? Your script seems to reference./file
instead oflog
?