Hi.

On Mon, 05 Nov 2018 15:00:04 +0100 Dario Lesca wrote:

> For example: "some-cmd | logger -t "some-cmd messages:"; echo $?"

> If "some-cmd" fail with status !=0 I get always status of last one, in
> this case 0

> In my case if the first command fail, I must send a warning message

> A more simple example is: "false | true"

> I want get status 1, of first command (false), not 0 (true)

Use the PIPESTATUS array:

    false | true; echo ${PIPESTATUS[0]}
    1

-- 
francis
_______________________________________________
users mailing list -- users@lists.fedoraproject.org
To unsubscribe send an email to users-le...@lists.fedoraproject.org
Fedora Code of Conduct: https://getfedora.org/code-of-conduct.html
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/users@lists.fedoraproject.org

Reply via email to