bug-bash
[Top][All Lists]
Advanced

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

Command substitution starting with a (()) expression should fail


From: Michael Diamond
Subject: Command substitution starting with a (()) expression should fail
Date: Sun, 31 Jan 2016 19:26:55 -0500

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: cygwin
Compiler: gcc
Compilation CFLAGS:  -DPROGRAM='bash.exe' -DCONF_HOSTTYPE='x86_64' -DCONF_OSTYPE='cygwin' -DCONF_MACHTYPE='x86_64-unknown-cygwin' -DCONF_VENDOR='unknown' -DLOCALEDIR='/usr/share/locale' -DPACKAGE='bash' -DSHELL -DHAVE_CONFIG_H -DRECYCLES_PIDS   -I.  -I/usr/src/bash-4.3.39-2.x86_64/src/bash-4.3 -I/usr/src/bash-4.3.39-2.x86_64/src/bash-4.3/include -I/usr/src/bash-4.3.39-2.x86_64/src/bash-4.3/lib  -DWORDEXP_OPTION -ggdb -O2 -pipe -Wimplicit-function-declaration -fdebug-prefix-map=/usr/src/bash-4.3.39-2.x86_64/build=/usr/src/debug/bash-4.3.39-2 -fdebug-prefix-map=/usr/src/bash-4.3.39-2.x86_64/src/bash-4.3=/usr/src/debug/bash-4.3.39-2
uname output: CYGWIN_NT-10.0 Aodh 2.0.4(0.287/5/3) 2015-06-09 12:22 x86_64 Cygwin
Machine Type: x86_64-unknown-cygwin

Bash Version: 4.3
Patch Level: 39
Release Status: release

Description:
I'm told $((( $exit_code == 0 )) && echo GREEN || echo RED) should fail
to parse, because $(( should be the first token, not $(.

I filed a bug https://github.com/koalaman/shellcheck/issues/590 after
running into a parser error with the ShellCheck service. They explained
the syntax I'm using *shouldn't* work, and indicated it was a bug in
Bash. I have used this syntax successfully on Cygwin, OSX, and Ubuntu.

Repeat-By:
$ exit_code=0
$ echo $((( $exit_code == 0 )) && echo GREEN || echo RED)
GREEN
$ exit_code=1
$ echo $((( $exit_code == 0 )) && echo GREEN || echo RED)
RED

Expected a parse error.

reply via email to

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