Friday, July 9, 2010

best practices in shell script programming – colons

My snipplet for an if/then/else in shell scripts looks like this:
if true
then :
else :
fi
The colons make that code syntactically complete, w/o the colons you run into a syntax error. The colon is the "null op" of (Bourne) shell scripting.
And the colons usually remain there for the remainder of the life of that code.
Have you noticed, that the youngsters, that talk about snipplets nowadays seriously think, they invented them? True, I guess, they created the term. Just the term.

No comments: