bash多行命令,在连续字符后带有注释
考虑 echo \ # this is a comment foo 这给出: $ sh foo.sh # this is a comment foo.sh: line 2: foo: command not found 在网上搜索后,我在姐妹网站Stack Overflow上找到了DigitalRoss的解决方案。所以一个人可以做 echo `: this is a comment` \ foo 或者 echo $(: this is a comment) \ foo 但是,DigitalRoss没有解释这些解决方案为何起作用。我希望得到一个解释。他回答说: 以前有一个shell goto命令,它会分支到:此处指定的标签。该goto走了,但你仍然可以使用的 : whatever语法... :是一种解析的评论了。 …