开发者

How to manipulate column values when using gnuplot from a shell script?

I'm using gnuplot from a bash script and I have to divide values from two columns:

plot "results.csv" using 1:($4/$6) notitle with lp

This works fine in gnuplot interactive mode, but when called from a script, the column values get mixed up with bash开发者_运维技巧 script arguments...How can I pass the col. values from the script?


This depends on how exactly you're invoking gnuplot from your script, as Sean asked in the comments.

Something like $4 will be expanded unless it's in single quotes, so that's one option. Anywhere else, you'll have to escape the $:

# print first argument
echo $1

# print literally $1, a few ways
echo '$1'
echo "\$1"
echo \$1
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜