pipe exit statuses

der.hans plug-devel@lists.PLUG.phoenix.az.us
Wed Apr 6 21:43:02 2005


moin, moin,

learned something cool about bash today. It's something that I've wished
for several times.

${PIPESTATUS[]} is an array that keeps track of the exit statuses of the
commands in a pipeline.

###
$ ls anke 2>/dev/null | ls fred 2>/dev/null | ls anke 2>/dev/null | echo

$ echo ${PIPESTATUS[*]}
1 0 1 0
###

Also, just in case someone doesn't know, bash also has programmable
completion.

source /etc/bash_completion on debian-based systems.

ciao,

der.hans
-- 
#  https://www.LuftHans.com/    http://www.AZOTO.org/
#  "If your girlfriend is crying crocodile tears it's because she's either
#  got salt in her eye or she's been listening to Air Supply"
#    -- Alice Cooper, 08Mar2005