Shell script error pending "make"

#!/bin/sh while true ; do echo "WTF" done 

This gives a syntax error: syntax error: unexpected end of file (waiting to be done)

I also tried:

 #!/bin/sh while : do echo "WTF" done 
+8
linux bash shell
source share
2 answers

I suspect line endings.

Try:

 hexdump -C yourscript.sh 

Look for the sequences 0d 0a . You can make \r ( 0d ) the tr command:

 cat yourscript.sh | tr -d '\r' >> yournewscript.sh 
+15
source share

Try:

 #!/bin/sh while [ true ] do echo "WTF" done 

Pay particular attention to spaces in the string 'while [true]'

+1
source share

All Articles