This is what I'm trying to do (it's just an example, not a real code):
\immediate\write18{echo "price: $5.00" > temp.tex}
\input{temp.tex}
This is what I see in temp.tex:
price: .00
What is a possible workaround?
This is what I'm trying to do (it's just an example, not a real code):
\immediate\write18{echo "price: $5.00" > temp.tex}
\input{temp.tex}
This is what I see in temp.tex:
price: .00
What is a possible workaround?
"Special" here is special to your shell so it depends which shell you are using. If I execute
echo "price: $5.00"
in bash I get
price: .00
So I need to execute
echo "price: \$5.00"
to get
price: $5.00
so I would need
\immediate\write18{echo "price: \string\$5.00" > temp.tex}
to get a $ into the file but since you input it back to TeX you need \$ in the file so
\immediate\write18{echo "price: \string\\\string\$5.00" > temp.tex}
$5 as shell/environment variable.
– Heiko Oberdiek
Oct 07 '12 at 10:48
\string\\ although we are both guessing that the OP was in fact using a unix shell. The main point is that you have to escape for your command line shell (with extra backslashes or single quotes and then you have arrange that the file read back in for tex has the correct tex markup, so \$ not just $ in this case.
– David Carlisle
Oct 07 '12 at 10:56
\write18. I usually do this. – kiss my armpit Oct 07 '12 at 10:37