On Sat, Jan 4, 2020 at 11:45 PM markus schnalke <meillo@marmaro.de> wrote:

> 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?

While developing, I frequently have some code like:

if test -f somefile
then
    cmd1
    cmd2
else
    echo somefile is missing
fi

I have the "else" clause because I initially want to explicitly see some output in that case. A bit later if I temporarily don't want the output (but want to keep the else and the echo line around) I can just put a colon before the echo. You can't do that with a # because you get a syntax error. And if you wanted to use # you'd then have to put in some other do-nothing line (maybe a : by itself) to keep valid syntax.  In a situation like this I will eventually end up deleting the echo line and the preceding else, but during development I like being able to use : in this way.

Terry



meillo