Operating System - HP-UX
1751877 Members
5312 Online
108782 Solutions
New Discussion юеВ

Re: 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 2
Mike Stroyan
Honored Contributor

Re: Posix shell pipe exit code array

Perhaps you were thinking of bash shell and echo ${PIPESTATUS[1]} .
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