冒号(:)命令是bash的内建命令,通常把它看作true命令。bash的help解释(help :)为:No effect; the command does nothing. A zero exit code is returned.(没有效果,该命令是空操作,退出状态总是0)。
用途
1、注释
: this is comment
: ' this is a multiple
lines comment.'
将注释作为参数传递给冒号命令, 因为没有输出所以可以当作注释阿,够巧妙吧。
2、清空文件
: > file
还有其他用途吗?知道的一定要留言告诉我啊。


lovedarling 于 2007-09-28 21:05:28发表:
linux的命令功能太强大了,不知道有多少,我觉得应该归类整理一下