Hush does not handle "set -o pipefail".

Christopher Barry christopher.barry at rackwareinc.com
Wed Nov 10 03:46:12 UTC 2010


I find this a fairly useful method in bash, if not perfect.

function pipe_status()
{
    local -a pipestatus=( ${@} )
    for ((p=0;p<${#pipestatus[@]};p++))
    do
        if [[ ${pipestatus[${p}]} -ne 0 ]]
        then
            echo "failure in pipe index ${p} (${pipestatus[${p}]})" >&2
            return ${pipestatus[${p}]}
        fi
    done
    return 0
}
#---------------------------------------------------------------------
do | a | really | long | pipe
pipe_status ${PIPESTATUS[@]} || handle_error ${?}


I don't use hush though, so no idea if this will work in that shell or
not.
-C

On Tue, 2010-11-09 at 01:40 -0500, Rob Landley wrote:
> Or any set -o for that matter.  But pipefail's one that's really hard to work 
> around if you haven't got it...
> 
> Rob




More information about the busybox mailing list