-3

I'm practicing some scripts from a book and I keep getting an unexpected end-of-file syntax error. The images below show the error message and the script that uses basic commands to create a system-information html file. The second set of images show my attempt to comment out the problematic lines and run it.

In the top part I have three functions that use here-documents to generate html tags, I'm using the '<<-' switch to allow me to indent the tags for readability. My issue is that the error I mentioned keeps popping up. If I change it to 'echo' commands it works just fine, the weird part is I have a here-document at the bottom of the script, outside of a function and that works just fine if I comment out the three functions. What I am I doing wrong?

dual terminal view: error message and script file

working shoot of script with commented out functions

closed as unclear what you're asking by devnull, manatwork, Anthon, Braiam, Zelda Apr 24 '14 at 15:28

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    Next time, please just use code blocks instead of images. – a CVn Apr 24 '14 at 13:33
  • Ok thanks, I was thinking it was hard to read any ways...and I just saw my terrible grammar, sorry. – KnowButton_Mashing Apr 25 '14 at 8:03
  • Grammar is not a big deal, but you code is not readible without clicking (and not copyable). Copy your code over here, otherwise no-one will help you. – Bernhard Apr 25 '14 at 11:45
  • Please use text instead of images. We are not about to manually transcribe your code to test it. – terdon Apr 25 '14 at 11:58
0

You are indenting the here-document end marker.

For it to be detected as such, the end marker must come at the beginning of a line of its own.

Unindent the end marker and you will likely find that your script works fine (at least as far as that goes).

  • Thank you very much that was the problem. I didn't even realize it, and not only where the markers indented but some even had trailing spaces. Greatly appreciate it Michael. – KnowButton_Mashing Apr 25 '14 at 8:01

Not the answer you're looking for? Browse other questions tagged or ask your own question.