bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bash is broken


From: Eric Blake
Subject: Re: Bash is broken
Date: Sun, 13 May 2007 08:19:13 -0600
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.10) Gecko/20070221 Thunderbird/1.5.0.10 Mnenhy/0.7.5.666

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

According to Overdorf, Sam on 5/13/2007 1:31 AM:
> The following does not work on my computers:
> 
>  
> 
> If [ "1" > "2" ]
> 
>   then

Your mailer corrupted what you typed, by adding spurious newlines, and
capitalizing the if.

Your report is not a bug in bash, but in your usage.  Either quote things
properly when invoking the POSIX-specified [:

if [ 1 \> 2 ]

or use the bash builtin [[ which does the implicit quoting for you:

if [[ 1 > 2 ]]

> This should be a string compare.

Actually, when quoted properly, it should be a numeric comparison, not a
string comparison.

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

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

iD8DBQFGRx5h84KuGfSFAYARAh8QAJ9Tk+sooDVvmKFaTH/3iu49YHpcQACgqaMl
1pLMZvNB3NF+s1P8QDEp2ek=
=rDZY
-----END PGP SIGNATURE-----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]