(冒號(hào))GNU Bash內(nèi)置的目的是什么?一個(gè)命令的目的是什么,它什么也不做,只是一個(gè)評(píng)論領(lǐng)導(dǎo)者,但實(shí)際上它本身就是一個(gè)shell內(nèi)置的東西?它比在腳本中插入注釋的速度慢,每次調(diào)用的速度大約為40%,這可能取決于評(píng)論的大小而有很大的差異。我能看到的唯一原因是:# poor man's delay functionfor ((x=0;x<100000;++x)) ; do : ; done# inserting comments into string of commandscommand ;
command ; : we need a comment in here for some reason ; command# an alias for `true' (lazy programming)while : ; do command ; done我想我真正想要的是它可能有什么樣的歷史應(yīng)用程序。
3 回答

慕俠2389804
TA貢獻(xiàn)1719條經(jīng)驗(yàn) 獲得超6個(gè)贊
#!/bin/bashif [[ "$VERBOSE" == "" || "$VERBOSE" == "0" ]]; then vecho=":" # no "verbose echo"else vecho=echo # enable "verbose echo"fi$vecho "Verbose echo is ON"
$ ./vecho $ VERBOSE=1 ./vechoVerbose echo is ON
: >afile
添加回答
舉報(bào)
0/150
提交
取消