bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ctrl-C and command lists


From: Julian Bradfield
Subject: ctrl-C and command lists
Date: Fri, 12 Sep 2008 09:42:39 +0100
User-agent: Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.20 (linux)

In every other shell I've used, the behaviour of ctrl-C in an
interactive shell is to interrupt the current command-line and return
to the shell prompt.
This is, I think, the behaviour expected by the user in almost all
circumstances. In the rare circumstance when one doesn't want to do
that, traps can be used.

Historically, bash has taken the approach that ctrl-C interrupts the
currently executing pipeline, but that's all. That results in the mad
panic when one does:

for f in * ; do destroy $f ; sleep 1; done
oh-shit-ctrl-C-ctrl-C-ctrl-C-oh-shit-ctrl-Z-I-hate-bash!

I see that the most recent bash has now changed its behaviour so
that ctrl-c breaks out of any executing loops, thereby solving the
above problem.

However, as pointed out recently by "jidanni" in RISKS 25.31, bash
still executes the rest of a list:

sleep 360000 ; launch_shuttle
 oops, found a problem with the O-rings, ctrl-C
VROOM!


I argue that bash should do what the user expects: in the absence of
traps, SIGINT should return to the prompt.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]