简体   繁体   English

bash防止回声逃逸

[英]bash prevent escaping with echo

I am relatively new to linux and am trying to create a TikZ figure parsing a file. 我是Linux的新手,正在尝试创建一个TikZ图形来解析文件。 In order to do so I read in the file with a $%&-bash script containing the following statement 为此,我使用包含以下语句的$%&-bash脚本读取文件

echo "\fill[color=blue] ($xp,$zp) circle (5pt);" >> $fout

this results in the following output 这导致以下输出

^Lill[color=blue] ($xp,$zp) circle (5pt);

Obviously echo escapes the \\f and I did not find a way around it. 显然,echo逃避了\\ f,我没有找到解决方法。 I have tried all options like "-e" "-n" and what have you, have tried all kinds of combinations of " ' etc, but to no avail. 我已经尝试了所有选项,例如“ -e”,“-n”以及您所尝试的所有组合,但是都没有用。

I am stuck as so often with linux, but this time even google didn't help (OMG=Oh My Google!!!!!!!!). 我经常被linux困扰,但是这次google都帮不上忙(OMG = Oh My Google !!!!!!!!)。

echo should not do backslash escapes by default, unless -e is specified. 默认情况下, echo不应进行反斜杠转义,除非指定了-e You can try echo -E to force turning them off (in case you have aliased echo to echo -e or something). 您可以尝试echo -E强制将其关闭(以防您将别名echo别名为echo -e或其他东西)。

Alternatively, try using single quotes (although now that I think about it, I don't see how it would help): 或者,尝试使用单引号(尽管我已经考虑过了,但我看不出它会有什么帮助):

echo '\fill[color=blue] ('"$xp,$zp"') circle (5pt);' >> $fout

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

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