How to properly nest Bash backticks

前端 未结 5 1069
死守一世寂寞
死守一世寂寞 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:51

    if you insist to use backticks, following could be done

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

    you have to put backslashes, \\ \\\\ \\\\\\\\ by 2x and so on, its just very ugly, use $(commands) as other suggested.

提交回复
热议问题