Re: [BUG] ERR trap triggered twice when using 'command'
From:
Chet Ramey
Subject:
Re: [BUG] ERR trap triggered twice when using 'command'
Date:
Mon, 2 Apr 2018 15:41:37 -0400
User-agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.6.0
On 4/1/18 6:54 AM, Martijn Dekker wrote:
> $ bash -c 'trap "echo WHOA" ERR; command false'
> WHOA
> WHOA
>
> Expected output: just one WHOA (as on *ksh, zsh)
Thanks for the report. This clearly falls under this clause
"In every other respect, if command_name is not the name of a function, the
effect of command (with no options) shall be the same as omitting command."
in the Posix description of `command'. It should be a one-line fix.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/