LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-02-2006, 11:30 PM   #1
frankie_DJ
Member
 
Registered: Sep 2004
Location: NorCal
Distribution: slackware 10.1 comfy, Solaris10 learning
Posts: 232

Rep: Reputation: 32
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.
 
Old 10-02-2006, 11:34 PM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

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

Hope this helps.
 
Old 10-02-2006, 11:35 PM   #3
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
end token needs to be flush left...

Move your "+" flush left.

For better readability, you might also consider renaming it from "+" to "!" or "EOF".
 
Old 10-02-2006, 11:50 PM   #4
frankie_DJ
Member
 
Registered: Sep 2004
Location: NorCal
Distribution: slackware 10.1 comfy, Solaris10 learning
Posts: 232

Original Poster
Rep: Reputation: 32
Thank you guys very much. The book where I learned about here document doesn't really mention that.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
simple linux script gone wrong stephen_davies Linux - Newbie 1 10-27-2005 06:00 AM
C++ question: can't figure out why this simple code does not work frankie_DJ Programming 2 12-25-2004 04:14 AM
simple q: can you use php inside an html document? BrianK Programming 2 12-10-2004 09:31 PM
very very simple identd question.. cant figure out myself.. need help!! kublador Linux - Networking 1 06-10-2003 03:17 AM
retard can't figure out simple things Karnak Linux - Hardware 13 10-05-2002 12:02 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 06:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration