调用长而繁琐的命令时,将它们写在shell脚本中是一个好习惯。有没有简单的方法可以在此类脚本中注释行?我尝试了以下方法,但均无济于事。
# the \ is also commented out, resulting in "command" and "--good-switch".
command \
#--bad-switch \
--good-switch \
# seems to send an extra argument to the command
command \
\ #--bad-switch \
--good-switch
\
转义下一个字符,该字符“隐藏”换行符,但使空格有意义)。