技术解析

bash shell 里的 soft quoting 问题
0
2021-07-08 18:12:52
idczone
soft quoting 里面有$,!,`和\这个四个不会禁用。
但是为什么
[[email protected] ~]# echo "\n"
\n


[[email protected] ~]# echo "\\"
\

我已经搞晕了。。
echo "/\n"

The backslash retains its special meaning only when followed by one of the following characters:
$, `, ", \, or .

LZ 的意思是如果按照 soft quoting 的说法,""不会 disable 掉\,所以 echo "\n"应该会得到 n ,而不是\n 。

get 到点了。。谢谢!

数据地带为您的网站提供全球顶级IDC资源
在线咨询
专属客服