[sf-lug] Fwd: [UMALUG] bash scripting question
rick at rbsmith.com
Fri Mar 7 19:36:29 PST 2008
jim stockford wrote:
> i've always viewed the : command as a no op
> (aka nop).
> even after reading and pondering, i cannot figure
> out a use other than perhaps as a placeholder, but
> a comment seems a much more useful placeholder.
> what is a good reason for putting the : command
> in a shell script?
The case where I've seen is to define an env variable
if not defined:
My understanding is this will leave FOO alone if
defined or set it to bar if not. The : is needed
because the expression also returns a value which
gets run, but as an option to :, it does nothing.
More information about the sf-lug