[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Error handling question
From: |
Chet Ramey |
Subject: |
Re: Error handling question |
Date: |
Sun, 08 Nov 2009 21:49:35 -0500 |
User-agent: |
Thunderbird 2.0.0.23 (Macintosh/20090812) |
Ciprian Dorin, Craciun wrote:
> Shouldn't any of the following scripts print `error`? (Bash
> 4.0.35(2)-release on ArchLinux.)
>
> Or I've miss-interpreted the documentation...
>
> Thanks,
> Ciprian.
>
>
> ~~~~
> set -e -o pipefail
> ( false ; echo ok ; ) || echo error
> ~~~~
>
> ~~~~
> set -e -o pipefail
> ( false ; echo ok ; ) | true || echo error
> ~~~~
>
> ~~~~
> set -e -o pipefail
> { false ; echo ok ; } || echo error
> ~~~~
>
> ~~~~
> set -e -o pipefail
> { false ; echo ok ; } | true || echo error
> ~~~~
No. Since `set -e' has no effect on the left side of the || or &&
operators, all of the commands preceding the || exit with status 0.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/
- Error handling question, Ciprian Dorin, Craciun, 2009/11/08
- Re: Error handling question,
Chet Ramey <=
- Message not available
- Re: Error handling question, Jan Schampera, 2009/11/09
- Re: Error handling question, Ciprian Dorin, Craciun, 2009/11/09
- Re: Error handling question, Greg Wooledge, 2009/11/09
- Re: Error handling question, Ciprian Dorin, Craciun, 2009/11/09
- Re: Error handling question, Greg Wooledge, 2009/11/09
- Re: Error handling question, Sven Mascheck, 2009/11/09