...
| You can use the || and && construction:
...
| if ! foo; then
| then
| bar1 == foo || ( bar1; bar2; ... )
| bar2
| ...
| fi
Pretty close, but the parentheses will cause the shell to fork a
subprocess, which is not only unnecessarily expensive but also changes
the semantics with respect to variables inside the block.
Use { } to get the block without the subprocess. Don't forget to white-space
separate them and include a line terminator at the end - { echo like this; }
{echo not like this}. Because stuff like that makes me cranky, I prefer
if foo
then :
else
bar1
..
fi
And of course, if you have strings to compare, use "case", that's what
it's for.
Donn Cave, University Computing Services, University of Washington
-------
Today's Fun Spelling Tip:
It's vs. its ... ever wonder whether you're getting it right?
Try he's vs. his, which follows the exact same rules.