LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (http://www.linuxquestions.org/questions/programming-9/)
-   -   Simple script with here document. Can't figure out what's wrong. (http://www.linuxquestions.org/questions/programming-9/simple-script-with-here-document-cant-figure-out-whats-wrong-488914/)

frankie_DJ 10-02-2006 11:30 PM

Simple script with here document. Can't figure out what's wrong.
 
Hi everyone,
I am having trouble with this pretty simple script that uses here document as an input to the plotting program gnuplot.
Code:

#!/bin/sh
for i in file1 file2 file3
do
        gnuplot<<+
        set multiplot
        set xrange [0:10]
        set xrange [0:1]
        plot $i u 3:5 w linespoints
        +
done

The error that I am getting is
Code:

./plot.sh: line 11: syntax error: unexpected end of file
Can someone point me out to what is wrong here? Thanks.

druuna 10-02-2006 11:34 PM

Hi,

The end token of the here document (+ in your case). should be placed against the left border (no indentation).

Hope this helps.

paulsm4 10-02-2006 11:35 PM

end token needs to be flush left...
 
Move your "+" flush left.

For better readability, you might also consider renaming it from "+" to "!" or "EOF".

frankie_DJ 10-02-2006 11:50 PM

Thank you guys very much. The book where I learned about here document doesn't really mention that.


All times are GMT -5. The time now is 11:55 PM.