Re: Posix shell pipe exit code array (260 Views)
Reply
Frequent Advisor
Posts: 64
Registered: ‎02-19-2003
Message 1 of 3 (260 Views)

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
Honored Contributor
Posts: 888
Registered: ‎11-22-1996
Message 2 of 3 (260 Views)

Re: Posix shell pipe exit code array

Perhaps you were thinking of bash shell and echo ${PIPESTATUS[1]} .
Frequent Advisor
Posts: 64
Registered: ‎02-19-2003
Message 3 of 3 (260 Views)

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
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.