shell脚本注释怎么写(linux shell菜鸟教程)

2022-07-16,,,,

第一种 采用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”

《shell脚本注释怎么写(linux shell菜鸟教程).doc》

下载本文的Word格式文档,以方便收藏与打印。