2d8874d9a7
Unless the shell is compiled with the (compilation time) option BOGUS_NOT_COMMAND (as in CFLAGS+=-DBOGUS_NOT_COMMAND) which it will not normally be, the ! command (reserved word) will only be permitted at the start of a pipeline (which includes the degenerate pipeline with no '|'s in it of course - ie: a simple cmd) and not in the middle of a pipeline sequence (no "cmd | ! cmd" nonsense.) If the latter is really required, then "cmd | { ! cmd; }" works as a standard equivalent. In POSIX mode, permit only one ! ("! pipeline" is ok. "! ! pipeline" is not). Again, if needed (and POSIX conformance is wanted) "! { ! pipeline; }" works as an alternative - and is safer, some shells treat "! ! cmd" as being identical to "cmd" (this one did until recently.)