On Sun, 13 Jul 97 00:45:57 -0400, Timothy Luoma <luomat(_at_)peak(_dot_)org>
wrote:
Perhaps I'm just too sleepy to figure this out, but how can I do this:
if [ "$VAR1" = "" ]
then
OTHERVAR=x
else
OTHERVAR=y
fi
OTHERVAR=${VAR1:+x}
OTHERVAR=${OTHERVAR:-y}
You can try to collapse that into a single assignment if readability
is something you feel you need to avoid. If OTHERVAR might already
have a value, you should empty it first.
It's harder if you want to test against a particular value other
than the empty string.
This is in fact a fairly standard sh construct (which is why the
manuals only mention it in passing, I guess).
Hope this helps,
/* era */
--
Defin-i-t-e-ly. Sep-a-r-a-te. Gram-m-a-r. <http://www.iki.fi/~era/>
* Enjoy receiving spam? Register at <http://www.iki.fi/~era/spam.html>