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 [.