From: Andre Noll Date: Sat, 14 Feb 2015 20:17:53 +0000 (+0100) Subject: common: Fix gsu_is_a_number(). X-Git-Url: http://git.tuebingen.mpg.de/?p=gsu.git;a=commitdiff_plain;h=5829a1d41d45ea6a8ce04292c8f4c9487a4414a4 common: Fix gsu_is_a_number(). We must use [ ... ] in gsu_is_a_number() because arithmetic expansion with ((...)) undergoes parameter and variable expansion. For example x=foo gsu_is_a_number "$x" will pass "foo" to gsu_is_a_number() where the expression (("$1")) tries to expand the (non-existing) variable foo, aborting the script if set -u was given. This bug was introduced a few month ago in commit 44860e92 (Use modern style arithmetic evaluation everwhere). --- diff --git a/common b/common index fe64cd6..e326890 100644 --- a/common +++ b/common @@ -39,7 +39,7 @@ EOF gsu_is_a_number() { result="$1" - if (("$1" == "$1")) &> /dev/null; then + if [ "$1" -eq "$1" ] &> /dev/null; then ret=$GSU_SUCCESS else ret=-$E_GSU_NOT_A_NUMBER