On 2017-04-26 10:23:11 -0400, Chet Ramey wrote:
> On 4/25/17 9:21 AM, Vincent Lefevre wrote:
> > If I add "set -m", then bash behaves like ash, etc., except that it
> > no longer reacts to Ctrl-C (the Ctrl-C only interrupts the sleep).
> 
> I'm curious what you think the shell should do in this case. Remember
> that it doesn't get the SIGINT. Other shells seem to fake it and act
> like they received a SIGINT, and abort the entire script. Should bash
> stop the loop, should it kill itself with SIGINT, or should it continue?

It should kill itself with SIGINT to mimic what happens in an
interactive shell. For instance, I expect

  bash -c 'set -m; while true; do date; sleep 1; done'

to behave like if

  while true; do date; sleep 1; done

were typed in an interactive bash.

This seems much more useful.

-- 
Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

Reply via email to