Posts tagged ‘bourne shell’

The under appreciated bourne shell “:” operator

“:” is a little known Bourne Shell operator which is actually quite handy. However, like a alot of other short hand operators, its easy to forget, especially when its not used that much.

So what can it do?

  • You can replace the true command with it, letting you write something like:

while :
do
some_commands
done

  • Leave the then part of an if statement empty:

if :
then :
else :
fi

I agree, that example is probably useless for now, but amusing none the less.

So there you are! Next time you fancy steering from the norm of using true, you know what to do!