[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: different exit codes in $? and ${PIPESTATUS[@]}
From: |
Dan Douglas |
Subject: |
Re: different exit codes in $? and ${PIPESTATUS[@]} |
Date: |
Sun, 14 Oct 2012 06:26:18 -0500 |
User-agent: |
KMail/4.8.3 (Linux/3.4.6-pf+; KDE/4.8.3; x86_64; ; ) |
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
- different exit codes in $? and ${PIPESTATUS[@]}, Wladimir Sidorenko, 2012/10/10
- Re: different exit codes in $? and ${PIPESTATUS[@]}, Andreas Schwab, 2012/10/10
- Re: different exit codes in $? and ${PIPESTATUS[@]}, Chet Ramey, 2012/10/12
- Re: different exit codes in $? and ${PIPESTATUS[@]}, Wladimir Sidorenko, 2012/10/12
- Re: different exit codes in $? and ${PIPESTATUS[@]}, Eric Blake, 2012/10/12
- Re: different exit codes in $? and ${PIPESTATUS[@]}, Chet Ramey, 2012/10/13
- Re: different exit codes in $? and ${PIPESTATUS[@]}, Wladimir Sidorenko, 2012/10/14
- Re: different exit codes in $? and ${PIPESTATUS[@]}, Andreas Schwab, 2012/10/14
- Re: different exit codes in $? and ${PIPESTATUS[@]}, Wladimir Sidorenko, 2012/10/14
- Re: different exit codes in $? and ${PIPESTATUS[@]}, Chet Ramey, 2012/10/14
- Re: different exit codes in $? and ${PIPESTATUS[@]},
Dan Douglas <=
- Re: different exit codes in $? and ${PIPESTATUS[@]}, Chet Ramey, 2012/10/14
- Re: different exit codes in $? and ${PIPESTATUS[@]}, Dan Douglas, 2012/10/15
- Re: different exit codes in $? and ${PIPESTATUS[@]}, Chet Ramey, 2012/10/15
- Re: different exit codes in $? and ${PIPESTATUS[@]}, Chet Ramey, 2012/10/14