Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #15781
| Path | csiph.com!xmission!news.snarked.org!news.linkpendium.com!news.linkpendium.com!panix!usenet.stanford.edu!not-for-mail |
|---|---|
| From | Eli Schwartz <eschwartz@archlinux.org> |
| Newsgroups | gnu.bash.bug |
| Subject | Re: possible bug in Bash 5.0 |
| Date | Wed, 25 Dec 2019 23:31:43 -0500 |
| Lines | 95 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.1440.1577334721.1979.bug-bash@gnu.org> (permalink) |
| References | <482a982b-c02b-65a3-68c5-e4c0e1f62874@uni-paderborn.de> <2351f424-162e-11ad-e762-d9fb2786f491@archlinux.org> |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 |
| Content-Type | multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="mxWbfUt4woXcSHUGr1PDboRa59B9NcObU" |
| X-Trace | usenet.stanford.edu 1577334722 14184 209.51.188.17 (26 Dec 2019 04:32:02 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| To | bug-bash@gnu.org |
| Envelope-to | bug-bash@gnu.org |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/simple; d=archlinux.org; s=orion; t=1577334706; bh=85tYL6+7KGPAAKNYs0YneBC3YSuxagnfVr2w6OPSr5I=; h=Subject:To:References:From:Date:In-Reply-To; b=KjtlwYq5gcjdUp599DrqidwvLkXHrfC86HfX0MbvSe5yV32Y9nuKFlBpYIrK5ludl LfRJ5W3RMRhE4huRJNXKPZKRqVInBBDfk1c9y10qs9qsYIBCB700xumivA/WoTXSxH lASMI/fu2VtfC2H1eago4cLdMArUqZuw7PUsk9yeKi9l+mjSNl3wlQQvuSlzGyq/JD rvEQD9sBjZc1C0PMzl1hJESY8DE/BaWqE6esu0YFCIEUzeluE2TYxe01seiv3o21iA WMA4x6wHGu2kKsK1yp/wBxjm1Sqi6W3cFYb4HCC+C8GY7JCCQlxm/anvjbhHO4JcjY alM4T831wG7WOtVDC6pp8i2yyPlnQcVJRA7G2SB6N4rTGktkyeuOeh3iWlJ+EsnYzv 5UIkXS3/OKppT3ebX+b2RkmK0qTtDw3070N8lefuG1Fr8b+7G98akjp6cs/e13AghO niNuRulF13kclFvw+jOAMo4qm0+uEJ8pf89niy/sBDGBFM9KimTi6YruV2fP0MJWU5 3HSYIhEWo/ginN+12KOBNd0XmML7DQKbceZbjR022II4du0Iq1pdjITeuvjH47caqQ 0itm/tkRtL0EyWo/DupdcTrmfOj0C0C1LMJhGuxqH6Cc/iTd0vsQKuI7eqZZRSvhmZ FGWQ0hZGiQKbw8hvbh3+PQd4= |
| X-Clacks-Overhead | GNU Terry Pratchett |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 |
| In-Reply-To | <482a982b-c02b-65a3-68c5-e4c0e1f62874@uni-paderborn.de> |
| X-detected-operating-system | by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] |
| X-Received-From | 88.198.91.70 |
| X-BeenThere | bug-bash@gnu.org |
| X-Mailman-Version | 2.1.23 |
| Precedence | list |
| List-Id | Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org> |
| List-Unsubscribe | <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe> |
| List-Archive | <https://lists.gnu.org/archive/html/bug-bash> |
| List-Post | <mailto:bug-bash@gnu.org> |
| List-Help | <mailto:bug-bash-request@gnu.org?subject=help> |
| List-Subscribe | <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe> |
| X-Mailman-Original-Message-ID | <2351f424-162e-11ad-e762-d9fb2786f491@archlinux.org> |
| X-Mailman-Original-References | <482a982b-c02b-65a3-68c5-e4c0e1f62874@uni-paderborn.de> |
| Xref | csiph.com gnu.bash.bug:15781 |
Show key headers only | View raw
[Multipart message — attachments visible in raw view] - view raw
On 12/25/19 5:41 PM, Xin Wu wrote: > Hi, > > I found the single-bracket [ ... ] and double-bracket [[ ... ]] behave > differently for string comparison in the follow simple Bash-script. > > # comma (,) is before two (2) in ASCII > a=,rst > b=2rst > if [ "$a" \> "$b" ]; then > echo "single-bracket" > fi > if [[ "$a" > "$b" ]]; then > echo "double-bracket" > fi > > According to some web pages I was expecting that single-bracket and > double-bracket should give same result. I'm not a Bash-expert, therefore > I'm not sure whether this is a real bug in Bash 5.0. > > Merry Christmas! > > Xin > > PS: the web pages are: > > * http://tldp.org/LDP/abs/html/comparison-ops.html > * http://tldp.org/LDP/abs/html/refcards.html > * http://mywiki.wooledge.org/BashFAQ/031 On the last of these three web pages is the note: "As of bash 4.1, string comparisons using < or > respect the current locale when done in [[, but not in [ or test. In fact, [ and test have never used locale collating order even though past man pages said they did. Bash versions prior to 4.1 do not use locale collating order for [[ either." Try using the C locale, for example: LC_COLLATE=C Then see what the double brackets does. -- Eli Schwartz Arch Linux Bug Wrangler and Trusted User
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
Re: possible bug in Bash 5.0 Eli Schwartz <eschwartz@archlinux.org> - 2019-12-25 23:31 -0500
csiph-web