Languages and Scripting
cancel
Showing results for 
Search instead for 
Did you mean: 

Posix shell pipe exit code array

Dan Martin_1
Frequent Advisor

Posix shell pipe exit code array

There used to be a special array in the HP posix shell that was loaded with the exit codes of each command in an executed pipe, ie:

echo "aaa" | sed 's/aaa/bbb/' | grep aaa

echo ${ARRNAME[1]} # Returns exit code of sed

ARRNAME, of course, is what I don't remember, and it seems to have disappeared from the documentation. Did it disappear from the posix shell also?

Dan
2 REPLIES
Mike Stroyan
Honored Contributor

Re: Posix shell pipe exit code array

Perhaps you were thinking of bash shell and echo ${PIPESTATUS[1]} .
Highlighted
Dan Martin_1
Frequent Advisor

Re: Posix shell pipe exit code array

Mike,

That is quite possible. I have been known to get the old wires crossed before.

Thanks,
Dan