Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I want to do something like:

echo "p 'myfile.txt' u 1:(exp($2))" | gnuplot -p

but need the shell to pass the $2 as a literal into gnuplot.

share|improve this question
add comment

1 Answer

Change your quoting around so that instead of double quotes (") use single quotes (') to wrap the entire argument to echo and use double quotes around the filename, like so:

$ echo 'p "myfile.txt" u 1:(exp($2))' | gnuplot -p

Example

Make some fake data:

$ for i in `seq 1 10`;do echo -e "$i\t$i";done > myfile.txt

Results in this:

1   1
2   2
3   3
4   4
5   5
6   6
7   7
8   8
9   9
10  10

Running the command, produces this graph:

$ echo 'p "myfile.txt" u 1:(exp($2))' | gnuplot -p

   ss of gnuplot graph

References

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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