这里的文件和双反斜线 [英] here document and double backslash

查看:303
本文介绍了这里的文件和双反斜线的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在包含多个反斜杠shell脚本'\\\\'使用这里的文件,外壳将其转换为一个反斜杠。我可以解决此不改变文字?

If I use a here document in a shell script that contains multiple backslashes '\\', the shell translates it into a single backslash. Can I work around this without changing the text ?


$猫<< EOF 结果
>打印\\\\ \\\\你好世界结果
> EOF 结果
打印\\你好\\世界

推荐答案

报价开始在这里的文件标记:

Quote the beginning here document marker:

cat <<'EOF'
Print \\hello \\world
EOF

这篇关于这里的文件和双反斜线的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆