简体   繁体   中英

bash prevent escaping with echo

I am relatively new to linux and am trying to create a TikZ figure parsing a file. In order to do so I read in the file with a $%&-bash script containing the following statement

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. I have tried all options like "-e" "-n" and what have you, have tried all kinds of combinations of " ' etc, but to no avail.

I am stuck as so often with linux, but this time even google didn't help (OMG=Oh My Google!!!!!!!!).

echo should not do backslash escapes by default, unless -e is specified. You can try echo -E to force turning them off (in case you have aliased echo to echo -e or something).

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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