How to properly nest Bash backticks

前端 未结 5 1099
死守一世寂寞
死守一世寂寞 2020-12-07 18:31

Either I missed some backlash or backlashing does not seem to work with too much programmer-quote-looping.

$ echo \"hello1-`echo hello2-\\`echo hello3-\\`ech         


        
5条回答
  •  不知归路
    2020-12-07 18:58

    It's a lot easier if you use bash's $(cmd) command substitution syntax, which is much more friendly to being nested:

    $ echo "hello1-$(echo hello2-$(echo hello3-$(echo hello4)))"
    hello1-hello2-hello3-hello4
    

提交回复
热议问题