I am writing a makefile in bash and I have a target in which I try to find if a file exists and even though I think the syntax is correct, i still gives me an error.
Here is the script that I am trying to run
read: if [ -e testFile] ; then \ cat testFile\ fi
I am using tabs so that is not a problem.
The error is (when I type in: ‘make read’)
if [ -e testFile] ; then \ cat testFile \ fi /bin/sh: Syntax error: end of file unexpected (expecting 'fi') make: *** [read] Error 2
Try adding a semicolon after
cat testFile. For example:alternatively: