我需要一个here文件上传TeX到在线shell.我不希望shell对内容做任何事情.以下MWE是我迄今为止管理得最好的.
cat << EOF > /tmp/mytex
\documentclass{article}
\begin{document}
Test mathematics: $ 2^{10} = 1024$ works but
$e^{i\pi} = -1$ is mangled because no space follows the $e$.
"double" and 'single' quotes should be preserved too.
\end{document}
EOF
Run Code Online (Sandbox Code Playgroud)
试试这个:
cat << 'EOF' > /tmp/mytex
\documentclass{article}
\begin{document}
Test mathematics: $ 2^{10} = 1024$ works but
$e^{i\pi} = -1$ is mangled because no space follows the $e$.
"double" and 'single' quotes should be preserved too.
\end{document}
EOF
Run Code Online (Sandbox Code Playgroud)
here-documents的格式是:
<<[-]word
here-document
delimiter
Run Code Online (Sandbox Code Playgroud)
如果引用单词中的任何字符,则分隔符是单词上的引号删除的结果,并且不会展开here-document中的行.
| 归档时间: |
|
| 查看次数: |
350 次 |
| 最近记录: |