== The difference in the Bourne shell between _:_ and _#_ I don't know how people learn the Bourne shell these days, but when I learned it, I first encountered '_:_' as a vaguely peculiar second way of writing comments, one used by some old shell scripts that hung around our systems. This is true as far as it goes, which is not necessarily very far. The difference between _#_ and _:_ is that _#_ starts a real comment that runs to the end of the line, while _:_ is a real command that just does nothing (this is what makes [[the _:;_ prompt trick ../sysadmin/ShellPromptTrick]] work). As a real command, its 'arguments' are parsed and things in it can have potential side effects, which means that you have to be careful what you put after it. However, this also means that it can be used in places that require an actual command. In the old days the classical example of this was in _if_ statements, because the Bourne shell had not yet picked up a general negation operator. Instead you had to write: > if something ....; then > : do nothing > else > # do the interesting thing > fi You couldn't use a _#_ comment in place of the _:_, because the Bourne shell grammar rules require that there be a statement (and thus a command). (Modern spec compliant Bourne shells have the general negation operator '_!_', so you can express this directly.) There are obscure uses for _:_ in other contexts; for example, if you want an infinite _while_ loop, the best way to write it is: > while : ; do ; done This has the same effect as using, say, _true_, but usually has less overhead. (Commenting things in the Bourne shell has a complicated history that does not fit in this entry.)