delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2008/08/22/00:52:39

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
X-Authority-Analysis: v=1.0 c=1 a=Kd08CeW4Oo0A:10 a=tzBgeO_4N2YA:10 a=xe8BsctaAAAA:8 a=kGmDpy8Kv4cIG7T85pAA:9 a=7rujZakRjvccowPw-c6xs6o7mYwA:4 a=eDFNAWYWrCwA:10 a=rPt6xJ-oxjAA:10
Message-ID: <48AE45E2.8090604@byu.net>
Date: Thu, 21 Aug 2008 22:51:46 -0600
From: Eric Blake <ebb9 AT byu DOT net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.16) Gecko/20080708 Thunderbird/2.0.0.16 Mnenhy/0.7.5.666
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: [ANNOUNCEMENT] Updated: csih-0.1.7-1
References: <announce DOT 48A789B6 DOT 3010103 AT cwilson DOT fastmail DOT fm> <48A78C6F DOT 2050403 AT cwilson DOT fastmail DOT fm> <20080820134209 DOT GN29104 AT calimero DOT vinschen DOT de> <48ADA260 DOT 3020901 AT cwilson DOT fastmail DOT fm> <20080821173028 DOT GA24882 AT calimero DOT vinschen DOT de> <48AE2E66 DOT 8060704 AT cwilson DOT fastmail DOT fm> <48AE435F DOT 5000600 AT byu DOT net>
In-Reply-To: <48AE435F.5000600@byu.net>
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

-----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 AT byu DOT 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019