简体   繁体   English

gnuplot和bash进程替换

[英]gnuplot and bash process substitution

Does gnuplot allow bash process substitution? gnuplot是否允许bash进程替换?

In gnuplot I can do: 在gnuplot中,我可以执行以下操作:

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? 应该可行,还是gnuplot不支持bash进程替换?

Here are 3 example input files: 这是3个示例输入文件:

cat tmp1 猫tmp1

A 1
B 2
C 3

cat tmp2 猫tmp2

B 3
C
D 6

cat tmp3 猫tmp3

A 4
B 6
C 8
D 10
E 12

The command following the < is executed with popen() , which uses /bin/sh (see man popen ). <后面的命令通过popen()执行,该命令使用/bin/sh (请参见man popen )。 So you must invoke bash explicitely in order to make use of the process substitution: 因此,您必须显式调用bash才能使用流程替换:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM