syntax error: unexpected end of file
Hopefully this is not a silly question. I am just repeating an example from the book <The Linux Command Line> Fourth Internet Edition by William Shotts. Taking the example on page 423, I always come across this problem. Can anyone help to figure it out?
Code:
#!/bin/bash Code:
#!/bin/bash |
Code:
cat <<- _EOF_ Use set -x to see what bash is doing... Code:
#!/bin/bash |
The eof has to at the beginning of the line. No spaces.
|
I think the - allows leading TABs.
And I think that characters ( and ) need to be escaped in order to satisfy the parser: \(All Users\) and \($USER\) |
Quote:
Code:
If the redirection operator is <<-, then all leading tab characters are stripped from input lines and the line containing delimiter. This allows here-documents within shell scripts to be indented in a natural fashion. That said, I'm pretty sure that there should be no spaces between the << or <<- and the word (in this case the word is _EOF_, but it can be any string). Try removing the space there. (confirmed...setting the leading spaces to tabs still threw the error. Removing the space after the << and <<- allowed the script to run.) |
Quote:
Code:
#!/bin/bash |
Quote:
|
All times are GMT -5. The time now is 08:23 AM. |