Date: Tue, 3 Jun 1997 00:03:16 +1000
From: Bruce Evans <bde@zeta.org.au>
To: freebsd-bugs@hub.freebsd.org, Harlan.Stenn@pfcs.com
Subject: Re: conf/3751: Improvements to /etc/rc{,.network,.pccard}
Message-ID: <199706021403.AAA31991@godzilla.zeta.org.au>
next in thread | raw e-mail | index | archive | help
> J> That's not entirely confusing syntax. It's normal habit to be on the
> J> safe side. Although i agree, the quotes should always be there,
>
> Agreed (obviously)
It's not obvious. '[ X$foo_enable = XYES ]' is better than
'[ "X$foo_enable" = XYES ]' for boolean variables, since it detects some
bogus values.
> J> Prepending the X saves you from hidden gotchas like in:
>
> J> foo="-ain't this weird?-"
>
> J> if [ "$foo" = "bar" ] ; ...
>
> Did you mean:
>
> if [ $foo = "bar" ] ; ...
>
> Shell metacharacters aren't expanded with "$foo".
I think he meant
foo="!"
Some strings may be misinterpreted as options or operators. There is no
problem in most cases because test's syntax gives precedence to the "="
operator, e.g., in
[ -a = bar ]
Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199706021403.AAA31991>
