On Sunday, October 14, 2012 11:46:17 AM Wladimir Sidorenko wrote:
> To my mind '!' looks pretty much like a unary operator and '|' like a binary
one.
This isn't as confusing as the associativity and nesting problem.
$ ( ! time ! : | :; echo $? "( ${PIPESTATUS[@]} )" ) 2>/dev/null
0 ( 0 0 )
$ ( ! ! : | :; echo $? "( ${PIPESTATUS[@]} )" )
0 ( 0 0 )
$ ( ! { ! :; } | :; echo $? "( ${PIPESTATUS[@]} )" )
1 ( 1 0 )
$ ( ! { ! : | : ; } | :; echo $? "( ${PIPESTATUS[@]} )" )
1 ( 1 0 )
I still don't completely understand how all of the above can be pipelines of
two elements if eacg bang denotes the begnning of a new pipeline. You would
expect to have at least one of these cases showing up as a one element
pipeline containing multi-element pipelines especially with "! !".
Both ksh and mksh additionally allow things like:
$ mksh -c ': | ! : | :; echo $? "( ${PIPESTATUS[@]} )"'
1 ( 0 1 )
$ mksh -c ': | ! { ! : | :; }; echo $? "( ${PIPESTATUS[@]} )"'
0 ( 0 0 )
I don't believe this is valid syntax, but also end up being pipelines of two
elements. Bash, dash, zsh, etc don't accept this.
--
Dan Douglas