shell脚本中经常看到这样的命令; :<< :> 很疑惑这是什么意思呢?网上一直也没有搜到,求指教!
1个回答
展开全部
冒号在shell中表示空指令。
原文如下:
:
null command [colon]. This is the shell equivalent of a "NOP" (no op, a do-nothing operation). It
may be considered a synonym for the shell builtin true. The ":" command is itself a Bash builtin, and its exit status is true (0).
所以:
: > file 用于清空文件
下面这种形式是Here Document的一种用法,用于注释一段代码块
:<<BLOCK
...
segment
...
BLOCK
原文如下:
:
null command [colon]. This is the shell equivalent of a "NOP" (no op, a do-nothing operation). It
may be considered a synonym for the shell builtin true. The ":" command is itself a Bash builtin, and its exit status is true (0).
所以:
: > file 用于清空文件
下面这种形式是Here Document的一种用法,用于注释一段代码块
:<<BLOCK
...
segment
...
BLOCK
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询