Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

'set -e' with '!' POSIX issue



'set -e' ('set -o errexit') is not POSIX compliant on zsh because it
doesn't ignore a command beginning with "!".

The script:

    set -e
    ! true
    echo good

should output "good", and does, on every shell except zsh.

Ref.:
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_25
| 2. The -e setting shall be ignored when executing the compound list
| following the while, until, if, or elif reserved word, a pipeline
| beginning with the ! reserved word, or any command of an AND-OR list
| other than the last.

(Note that in POSIX terms the definition of "pipeline" includes a simple
command.)

Thanks,

- Martijn



Messages sorted by: Reverse Date, Date, Thread, Author