bug-bash
[Top][All Lists]
Advanced

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

possible bug in Bash 5.0


From: Xin Wu
Subject: possible bug in Bash 5.0
Date: Wed, 25 Dec 2019 23:41:38 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2

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



reply via email to

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