|

楼主 |
发表于 2006-3-18 00:21:18
|
显示全部楼层
Post by yongjian
no, a single "\" in `` means nothing. it will get rid of it first and then bring the rest to subshell. if you want to get $x, you need to do, so that `` will treat it as its literal value "\" and bring it to the subshell, in that case, bash will see "echo \$x", which is the same as $(echo \$x). In bash echo, a single "\" will be treated literally, so it can esc "$".
yongjian兄:
鉴于怕产生理解上的错误,我还是用中文表达吧。
no, a single "\" in `` means nothing.
以上这句是指\将不被当前shell作为metacharacter处理对吗,所以不逃逸后面的$?
In bash echo, a single "\" will be treated literally, so it can esc "$".
对上面这句不理解,单个\被最为普通字符处理,而又可以逃逸$?
这样的话,问题就有两个:
1。如果命令替换中存在backslash,它是在子shell中被处理的吗,会对其后紧跟的特殊字符(例如$) 产生逃逸作用呢?
2。根据大家的总结,在``中\被特殊处理,而在$()中\被认为普通字符
忘yongjian兄不惜赐教。小弟是个刨根问底的人,麻烦了!!!:thank |
|