From: jar
To: bug-bash@gnu.org,b...@packages.debian.org
Subject: numerical comparison missing in bash and expr
Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='linux-gnu' -DCONF_MACHTYPE='x86_64-pc-linux-gnu'
-DCONF_VENDOR='pc' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL
-DHAVE_CONFIG_H -I. -I../. -I.././include -I.././lib -Wdate-time
-D_FORTIFY_SOURCE=2 -g -O2 -fdebug-prefix-map=/build/bash-N2nMjo/bash-4.4.18=.
-fstack-protector-strong -Wformat -Werror=format-security -Wall
-Wno-parentheses -Wno-format-security
uname output: Linux rrl 4.15.0-88-generic #88-Ubuntu SMP Tue Feb 11 20:11:34
UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-pc-linux-gnu
Bash Version: 4.4
Patch Level: 20
Release Status: release
Description:
all numerical tests using -ne, -lt, -le, -gt, or -ge fail. It appears
that only string comparison is used.
Repeat-By:
[ 5 < 10 ] && echo true || echo false
[ 5 > 10 ] && echo true || echo false
n=5
[ $n < 10 ] && echo true || echo false
[ $n > 10 ] && echo true || echo false
[ 5 -lt 10 ] && echo true || echo false
[ 5 -gt 10 ] && echo true || echo false
n=5
[ $n -lt 10 ] && echo true || echo false
[ $n -gt 10 ] && echo true || echo false
The above lines work in the following bash version:
GNU bash, version 4.3.11(1)-release (i686-pc-linux-gnu)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
Fix:
[Description of how to fix the problem. If you don't know a
fix for the problem, don't include this section.]