gnuplot, here-documents, and command line arguments
Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
Can I use a here document to pass a gnuplot script to gnuplot and also have commandline line arguments passed to gnuplot?
In my bash file, I would normally write:
#!/bin/bash
#set up code in here...
gnuplot -c script.gp $first $second
But I want to have everything in one bash file, so I've done
#!/bin/bash
#set up code in here...
gnuplot -c <<- EOF
do for [j=0:ARG1]
do for [i=4:ARG2]
plot '$data' index j using 2:i with lp
EOF $first $second
but I get the infamous warning: here-document at line 87 delimited by end-of-file (wanted
EOF')`` error. $data
, $first
, and $second
are defined earlier in the bash script.
If I put the command line arguments on the next line, to leave the EOF alone, I get command not found errors associated with the value of $first
.
My here document is indented only with tabs. There is no trailing whitespace.
bash here-document gnuplot
add a comment |Â
up vote
0
down vote
favorite
Can I use a here document to pass a gnuplot script to gnuplot and also have commandline line arguments passed to gnuplot?
In my bash file, I would normally write:
#!/bin/bash
#set up code in here...
gnuplot -c script.gp $first $second
But I want to have everything in one bash file, so I've done
#!/bin/bash
#set up code in here...
gnuplot -c <<- EOF
do for [j=0:ARG1]
do for [i=4:ARG2]
plot '$data' index j using 2:i with lp
EOF $first $second
but I get the infamous warning: here-document at line 87 delimited by end-of-file (wanted
EOF')`` error. $data
, $first
, and $second
are defined earlier in the bash script.
If I put the command line arguments on the next line, to leave the EOF alone, I get command not found errors associated with the value of $first
.
My here document is indented only with tabs. There is no trailing whitespace.
bash here-document gnuplot
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
Can I use a here document to pass a gnuplot script to gnuplot and also have commandline line arguments passed to gnuplot?
In my bash file, I would normally write:
#!/bin/bash
#set up code in here...
gnuplot -c script.gp $first $second
But I want to have everything in one bash file, so I've done
#!/bin/bash
#set up code in here...
gnuplot -c <<- EOF
do for [j=0:ARG1]
do for [i=4:ARG2]
plot '$data' index j using 2:i with lp
EOF $first $second
but I get the infamous warning: here-document at line 87 delimited by end-of-file (wanted
EOF')`` error. $data
, $first
, and $second
are defined earlier in the bash script.
If I put the command line arguments on the next line, to leave the EOF alone, I get command not found errors associated with the value of $first
.
My here document is indented only with tabs. There is no trailing whitespace.
bash here-document gnuplot
Can I use a here document to pass a gnuplot script to gnuplot and also have commandline line arguments passed to gnuplot?
In my bash file, I would normally write:
#!/bin/bash
#set up code in here...
gnuplot -c script.gp $first $second
But I want to have everything in one bash file, so I've done
#!/bin/bash
#set up code in here...
gnuplot -c <<- EOF
do for [j=0:ARG1]
do for [i=4:ARG2]
plot '$data' index j using 2:i with lp
EOF $first $second
but I get the infamous warning: here-document at line 87 delimited by end-of-file (wanted
EOF')`` error. $data
, $first
, and $second
are defined earlier in the bash script.
If I put the command line arguments on the next line, to leave the EOF alone, I get command not found errors associated with the value of $first
.
My here document is indented only with tabs. There is no trailing whitespace.
bash here-document gnuplot
bash here-document gnuplot
asked Aug 8 at 6:29
masher
1084
1084
add a comment |Â
add a comment |Â
2 Answers
2
active
oldest
votes
up vote
1
down vote
You could try something like:
gnuplot -c /dev/stdin "$first" "$second" <<-EOF
do for [j=0:ARG1]
do for [i=4:ARG2]
plot '$data' index j using 2:i with lp
EOF
Gnuplot complains
line 4: No previous filename
but then I get the same error when using a script file, so it's probably something to do with the code being incomplete.
add a comment |Â
up vote
0
down vote
This is one solution: get rid of the arguments, and do the replacement manually.
#!/bin/bash
#set up code in here...
gnuplot <<- EOF
do for [j=0:$first]
do for [i=4:$second]
plot '$data' index j using 2:i with lp
EOF
add a comment |Â
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
You could try something like:
gnuplot -c /dev/stdin "$first" "$second" <<-EOF
do for [j=0:ARG1]
do for [i=4:ARG2]
plot '$data' index j using 2:i with lp
EOF
Gnuplot complains
line 4: No previous filename
but then I get the same error when using a script file, so it's probably something to do with the code being incomplete.
add a comment |Â
up vote
1
down vote
You could try something like:
gnuplot -c /dev/stdin "$first" "$second" <<-EOF
do for [j=0:ARG1]
do for [i=4:ARG2]
plot '$data' index j using 2:i with lp
EOF
Gnuplot complains
line 4: No previous filename
but then I get the same error when using a script file, so it's probably something to do with the code being incomplete.
add a comment |Â
up vote
1
down vote
up vote
1
down vote
You could try something like:
gnuplot -c /dev/stdin "$first" "$second" <<-EOF
do for [j=0:ARG1]
do for [i=4:ARG2]
plot '$data' index j using 2:i with lp
EOF
Gnuplot complains
line 4: No previous filename
but then I get the same error when using a script file, so it's probably something to do with the code being incomplete.
You could try something like:
gnuplot -c /dev/stdin "$first" "$second" <<-EOF
do for [j=0:ARG1]
do for [i=4:ARG2]
plot '$data' index j using 2:i with lp
EOF
Gnuplot complains
line 4: No previous filename
but then I get the same error when using a script file, so it's probably something to do with the code being incomplete.
answered Aug 8 at 7:21
muru
33.6k577144
33.6k577144
add a comment |Â
add a comment |Â
up vote
0
down vote
This is one solution: get rid of the arguments, and do the replacement manually.
#!/bin/bash
#set up code in here...
gnuplot <<- EOF
do for [j=0:$first]
do for [i=4:$second]
plot '$data' index j using 2:i with lp
EOF
add a comment |Â
up vote
0
down vote
This is one solution: get rid of the arguments, and do the replacement manually.
#!/bin/bash
#set up code in here...
gnuplot <<- EOF
do for [j=0:$first]
do for [i=4:$second]
plot '$data' index j using 2:i with lp
EOF
add a comment |Â
up vote
0
down vote
up vote
0
down vote
This is one solution: get rid of the arguments, and do the replacement manually.
#!/bin/bash
#set up code in here...
gnuplot <<- EOF
do for [j=0:$first]
do for [i=4:$second]
plot '$data' index j using 2:i with lp
EOF
This is one solution: get rid of the arguments, and do the replacement manually.
#!/bin/bash
#set up code in here...
gnuplot <<- EOF
do for [j=0:$first]
do for [i=4:$second]
plot '$data' index j using 2:i with lp
EOF
answered Aug 8 at 6:55
masher
1084
1084
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f461212%2fgnuplot-here-documents-and-command-line-arguments%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password