How to get exit status from a piped command in Linux shell

Discussion in 'Linux News' started by News, Feb 21, 2012.

  1. News

    News LF News Poster

    Messages:
    614
    Likes Received:
    3
    Trophy Points:
    0
    It’s funny how through small daily tasks sometimes it happen to find new features or commands that you do not knew not, and today this thing happened to me. In particular, I had to do something trivial on the shell of a server, run : command1... Full story here.

    More...

  2. KenJackson

    KenJackson Active Member

    Messages:
    129
    Likes Received:
    27
    Trophy Points:
    28
    Cool!
    Here's the summary:
    Code:
    true | false | false | true | true
    echo "${PIPESTATUS[@]}"
    0 1 1 0 0

Share This Page