Bash help requested: Capturing command errors within pipes
Steven W. Orr
steveo at syslang.net
Thu Mar 19 19:01:34 UTC 2009
On Thursday, Mar 19th 2009 at 14:11 -0000, quoth Daniel B. Thurman:
=>S P Arif Sahari Wibowo wrote:
=>> On Thu, 19 Mar 2009, Daniel B. Thurman wrote:
=>> > How could one go about capturing command errors within pipes?
=>>
=>> The variable $PIPESTATUS is just for that.
=>>
=>I tried it, seems not to work.
=>
=>Try capturing a sed error when re1 or re2 has a bad regular
=>expression string. I have not been able to catch the error.
Sorry, but you'll have to supply something more specific. It's possible
for a program to have an error but not return a proper exit status.
But so far, my highly scientific test has revealed that all is good in
pipe testing land in the Kingdom of Bash.
578 > true | false | true | true
579 > echo ${PIPESTATUS[@]}
0 1 0 0
--
Time flies like the wind. Fruit flies like a banana. Stranger things have .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net
More information about the users
mailing list