Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14442 > unrolled thread
| Started by | anant garg <garginfo158@gmail.com> |
|---|---|
| First post | 2018-08-06 16:14 +0530 |
| Last post | 2018-08-06 16:14 +0530 |
| Articles | 1 — 1 participant |
Back to article view | Back to gnu.bash.bug
Improper handling of \! and \( while using Bash V4.1.2 anant garg <garginfo158@gmail.com> - 2018-08-06 16:14 +0530
| From | anant garg <garginfo158@gmail.com> |
|---|---|
| Date | 2018-08-06 16:14 +0530 |
| Subject | Improper handling of \! and \( while using Bash V4.1.2 |
| Message-ID | <mailman.4737.1533558714.1292.bug-bash@gnu.org> |
Hi , I am using the below environment. Linux kernel :- kernel-2.6.32-504.16.2.el6.x86_64 Bash version :- bash-4.1.2-29.x86_64 In our production code, one test related to parameter validation failed as below :- $ mode=! $ [ "$mode" != "ro" -a "$mode" != "rw" ] && echo OK + '[' '!' '!=' ro -a '!' '!=' rw ']' bash: [: too many arguments I checked the source and found that when multiple checks are done in one single test expression then ! parsing fails. For eg, the below works :- $ mode=! $ [ "$mode" != "ro" ] && echo OK OK The below also works :- $ mode=\! $ [ "$mode" != "ro" ] && echo OK OK The below also works :- $ mode=\( $ [ "$mode" != "ro" ] && echo OK OK but when below is run where multiple conditions are tested, then the parsing fails. For eg:- mode=\( [ "$mode" != "ro" -a "$mode" != "rw" ] && echo OK bash: [: `)' expected, found ro I tried testing with other special characters as well, but this issue came with only !,\! or \(. When I tested with extended test i.e [[ , this issue did not came. Was there any known bug in Bash V4.1.2 related to parsing of multiple ! or \( in [.
Back to top | Article view | gnu.bash.bug
csiph-web