V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
Distributions
Ubuntu
Fedora
CentOS
中文资源站
网易开源镜像站
blueionic
V2EX  ›  Linux

bash shell 里的 soft quoting 问题

  •  
  •   blueionic · 2015-10-03 18:10:47 +08:00 · 1912 次点击
    这是一个创建于 3134 天前的主题,其中的信息可能已经有所发展或是发生改变。
    soft quoting 里面有$,!,`和\这个四个不会禁用。
    但是为什么
    [root@ZZZZ ~]# echo "\n"
    \n


    [root@ZZZZ ~]# echo "\\"
    \

    我已经搞晕了。。
    4 条回复    2015-10-03 19:06:14 +08:00
    Ansen
        1
    Ansen  
       2015-10-03 18:45:46 +08:00 via iPhone
    echo "/\n"
    lululau
        2
    lululau  
       2015-10-03 18:51:11 +08:00   ❤️ 1
    The backslash retains its special meaning only when followed by one of the following characters:
    $, `, ", \, or <newline>.
    blueionic
        3
    blueionic  
    OP
       2015-10-03 18:52:12 +08:00
    @Ansen LZ 的意思是如果按照 soft quoting 的说法,""不会 disable 掉\,所以 echo "\n"应该会得到 n ,而不是\n 。
    blueionic
        4
    blueionic  
    OP
       2015-10-03 19:06:14 +08:00
    @lululau get 到点了。。谢谢!
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   777 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 20:14 · PVG 04:14 · LAX 13:14 · JFK 16:14
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.