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

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

(0)
小多多的头像小多多创始人

相关推荐

发表回复

登录后才能评论