On Tue, Dec 05, 2006 at 12:32:38PM +0800, Uwe Dippel wrote:
> 2 humble suggestions to make my server OS of choice even better.
> 
> I seem to have found a bug in ksh:
> Here is a sample that doesn't behave as I'd expect it to.
> 
> # demo=""
> #  if [ "$demo" == "-n" -o "$demo" == "-e" ]; then
> > echo bar
> > fi
> # demo="-n"
> #  if [ "$demo" == "-n" -o "$demo" == "-e" ]; then
> > echo bar
> > fi
> ksh: [: -n: unexpected operator/operand
> 
> IMHO, I'd consider it a bug, since the correctness of syntax must
> not change with the value of the variable. 
> AFAIK, this syntax is considered correct generally; if not, please
> advise me.

Take a look at the way /etc/rc does stuff like this:

[EMAIL PROTECTED]:ttyp1[~]$ if [ x"$demo" == x"-n" -o x"$demo" == x"-e" ]; then
> echo bar
> fi
bar

-Dan

-- 
"Burnished gallows set with red
 Caress the fevered, empty mind
 Of man who hangs bloodied and blind
 To reach for wisdom, not for bread."  -- Deoridhe Grimsdaughter

Reply via email to