gnuplot and bash process substitution

不羁的心 提交于 2019-12-17 20:23:58

问题


Does gnuplot allow bash process substitution?

In gnuplot I can do:

plot "<join tmp1 tmp2" u 2:3

But I can't get this to work:

plot "<join tmp1 <(join tmp2 tmp3)" u 2:3

Should it work, or isn't bash process substitution supported in gnuplot?

Here are 3 example input files:

cat tmp1

A 1
B 2
C 3

cat tmp2

B 3
C
D 6

cat tmp3

A 4
B 6
C 8
D 10
E 12

回答1:


The command following the < is executed with popen(), which uses /bin/sh (see man popen). So you must invoke bash explicitely in order to make use of the process substitution:

plot '< exec bash -c "join tmp1 <(join tmp2 tmp3)"' using 2:3

In your case with the single substitution the following would also do:

plot '< join tmp2 tmp3 | join tmp1 -' using 2:3


来源:https://stackoverflow.com/questions/19290333/gnuplot-and-bash-process-substitution

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!