Hoi.
[2020-01-04 23:19] Terry Jones <terry(a)jon.es>
Was : actually designed for commenting?
Hardly, because who would want comments to have side effects:
: don't do this
Or this:
: ignored; echo executed
Or this dangerously ``outcommented'' line:
: test ... && rm file
!
Using : for comments is only possible as the command does nothing
and ignores its arguments ... but the shell parses the arguments
as for every other command ... and executes stuff in the line that
are no arguments to :.
In case of #, the rest of the line is truly ignored, as comments
should be like.
but : is much nicer because you can
"comment" out a
single command in (e.g.) an if/then and it remains syntactically valid and
executable. I find it very elegant.
Can you please give an example for me to understand what you mean
by that?
meillo