[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
variable containing syntax error in conditional expression reports no di
From: |
g . branden . robinson |
Subject: |
variable containing syntax error in conditional expression reports no diagnostics |
Date: |
Wed, 24 Feb 2016 09:13:34 -0500 |
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-unknown-linux-gnu'
-DCONF_VENDOR='unknown' -DLOCALEDIR='/users/brarobin/share/locale'
-DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -I. -I. -I./include -I./lib -g -O2
uname output: Linux cc-dev-2 2.6.18-404.el5 #1 SMP Sat Mar 7 04:14:13 EST 2015
x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-unknown-linux-gnu
Bash Version: 4.3
Patch Level: 30
Release Status: release
Description:
I get a [[ ]] test failure with no error diagnostic, tricking me
into thinking the test legitimately failed when the culprit was
really a bad regex.
Repeat-By:
Constrast:
$ [[ foo =~ ) ]] && echo match || echo no match
bash: syntax error in conditional expression: unexpected token `)'
bash: syntax error near `)'
$ REGEX=')'
$ $ [[ foo =~ $REGEX ]] && echo match || echo no match
no match
end
- variable containing syntax error in conditional expression reports no diagnostics,
g . branden . robinson <=