This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [ANNOUNCEMENT] Updated: csih-0.1.7-1


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Eric Blake on 8/21/2008 10:41 PM:
> You don't necessarily need the extra subshells.
> 
> if shell_fun_call && [ $var -eq "foo" ]
> 
> is valid shell, provided $var is guaranteed to be non-empty, doesn't start
> with any character that might confuse test (such as '-', '!', '(', etc.),
> and doesn't contain whitespace.

Actually, -eq implies numeric comparison, but "foo" is not a number.  And
I prefer test over [ ] (but that's the autoconf side of me speaking).  If
you want to be really robust, write:

if shell_fun_call && test "x$var" = xfoo

- --
Don't work too hard, make some time for fun as well!

Eric Blake             ebb9@byu.net
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkiuReIACgkQ84KuGfSFAYDOKQCfX+TtTvrVrZs6GuTVEUhKQZV1
/9gAn1f2rowTlldEy5jPa25/myKgkTmG
=fjF5
-----END PGP SIGNATURE-----

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]