shell腳本中經(jīng)常看到這樣的命令; :<< :> 很疑惑這是什么意思呢?求指教!
1 回答

慕尼黑的夜晚無(wú)繁華
TA貢獻(xiàn)1864條經(jīng)驗(yàn) 獲得超6個(gè)贊
冒號(hào)在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
添加回答
舉報(bào)
0/150
提交
取消