Languages and Scripting
Showing results for 
Search instead for 
Do you mean 

Posix shell pipe exit code array

Frequent Advisor [Founder]

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
Honored Contributor [Founder]

Re: Posix shell pipe exit code array

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

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