简体   繁体   English

如何在gnuplot的oneliner中使用三个引号?

[英]How to have three quote marks in gnuplot's oneliner?

Assume your pseudocode is where the mistake is with two times using the quotes " 假设你的伪代码,其中的错误是用引号两次"

gnuplot - e "set output 'tmp.png'; set_label(x,text) = sprintf("set label '%s' at cos(%f)", text, x, x)

which is wrong. 这是错误的。

How can you have three types of quotes in gnuplot one-liner? gnuplot一线式报价中如何有三种类型的报价?

You must simply escape the second double quote characters for the shell (not for gnuplot!) with a backslash: 您只需使用反斜杠对shell的第二个双引号字符(而不是gnuplot!)进行转义:

gnuplot -e "set output 'tmp.png'; set_label(x,text) = sprintf(\"set label '%s' at cos(%f)\", text, x, x)"

Alternatively, you can use gnuplot's mechanism of escaping: use double single quotes to escape one single quote character: 另外,您可以使用gnuplot的转义机制:使用双单引号转义一个单引号字符:

gnuplot -e "set output 'tmp.png'; set_label(x,text) = sprintf('set label ''%s'' at cos(%f)', text, x, x)"

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

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