第一种 采用here document特性,实现多行注释,如:
#!/bin/bash
<<‘comment’
…
comment
第二种 : + 空格 +单引号 方式,如:
#!/bin/bash
: ‘
comment1
comment2
‘
潜藏问题: 不会注释 shell 脚本中本身带有单引号的语句部分.
第三种:采用 : + << ‘comment’ 的方式,如:
#!/bin/bash
echo “hello world”
: <<‘comment’
your comment 1
comment 2
…..comment
echo “something else”
第四种 每行都加#,如:
#!/bin/bash
# your comment
# comment 1
# comment 2
echo “hello world”