Re: Improper handling of \! and \( while using Bash V4.1.2

2018-08-06 Thread Greg Wooledge
On Mon, Aug 06, 2018 at 04:14:49PM +0530, anant garg wrote: > $ mode=! > $ [ "$mode" != "ro" -a "$mode" != "rw" ] && echo OK > + '[' '!' '!=' ro -a '!' '!=' rw ']' > bash: [: too many arguments The use of -a and -o as conjunctions inside a test or [ command is to be avoided. It's not POSIX

Improper handling of \! and \( while using Bash V4.1.2

2018-08-06 Thread anant garg
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