On 8/11/14, 3:05 PM, Geir Hauge wrote:
> And lastly, in interactive mode
> $ set +m; shopt -s lastpipe; trap -- "printf x" ERR; true | { true | false;
> }
> xxx
>
> Can't quite understand why it would trigger the ERR trap thrice.
That's easy enough to explain. The ERR trap is triggered wherever the -e
option, if it were set, would cause the shell to exit. There are three
places where a command fails: the `false', the group command (pipeline) on
the RHS of the outer pipeline, and the outer pipeline itself. Any of
these faiures would cause the shell to exit, but you don't have -e set.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU [email protected] http://cnswww.cns.cwru.edu/~chet/