First thing: bash is whitespace sensitive. That means this is no good:
Notice, a space at position 3,5,7, and 17. Those all MUST be there. If you use an editor with syntax highlighting for shell scripts (eg, vim), it will be slightly easier to notice that.
if [ ! -f $file1 ]
But also your syntax is missing some things. Try this:
echo "Enter Name of the first file:"
if [ ! -f $file1 ]; then
echo "Sorry, file does not exist."
Because your whitespace was wrong. The ! is right up against [, meaning [! was taken as a single token.
Originally Posted by TaiL