When receiving SIGINT, does bash also quit other commands, besides loops (for or while)?
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
From bash manual
When Bash receives a SIGINT, it breaks out of any executing loops.
When receiving SIGINT, does bash also quit other commands, besides loops (for or while)? Thanks.
bash signals sigint
add a comment |Â
up vote
1
down vote
favorite
From bash manual
When Bash receives a SIGINT, it breaks out of any executing loops.
When receiving SIGINT, does bash also quit other commands, besides loops (for or while)? Thanks.
bash signals sigint
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
From bash manual
When Bash receives a SIGINT, it breaks out of any executing loops.
When receiving SIGINT, does bash also quit other commands, besides loops (for or while)? Thanks.
bash signals sigint
From bash manual
When Bash receives a SIGINT, it breaks out of any executing loops.
When receiving SIGINT, does bash also quit other commands, besides loops (for or while)? Thanks.
bash signals sigint
asked May 28 at 1:56
Tim
22.6k61222401
22.6k61222401
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
Quoting the bash manual:
When
bash
is interactive, in the absence of any traps, it ignores
SIGTERM
(so thatkill 0
does not kill an interactive shell), and
SIGINT
is caught and handled (so that thewait
builtin is interruptible).
Yes, bash quits builtins when it receives SIGINT
. You can verify that with wait
or read
(read
from a large file with no newlines will give you time to press CtrlC). wait
in particular needs to deal with SIGINT
correctly, as per POSIX (along with all other signals it can come across).
Thanks. Besides loop and builtins, does bash quit anything else?
â Tim
May 28 at 11:39
What else could it quit?
â Stephen Kitt
May 28 at 13:07
like other control flow contructs such as "if" and external commands? Why are they not mentioned?
â Tim
May 28 at 13:14
External commands deal withSIGINT
themselves (the shell is informed if an external command was killed by a signal, but it deals with that by interpreting the information given bywait(2)
orwaitpid(2)
, not by installing a signal handler).if
etc. run at a point in time, so thereâÂÂs not much point in making them interruptible.
â Stephen Kitt
May 28 at 13:22
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
Quoting the bash manual:
When
bash
is interactive, in the absence of any traps, it ignores
SIGTERM
(so thatkill 0
does not kill an interactive shell), and
SIGINT
is caught and handled (so that thewait
builtin is interruptible).
Yes, bash quits builtins when it receives SIGINT
. You can verify that with wait
or read
(read
from a large file with no newlines will give you time to press CtrlC). wait
in particular needs to deal with SIGINT
correctly, as per POSIX (along with all other signals it can come across).
Thanks. Besides loop and builtins, does bash quit anything else?
â Tim
May 28 at 11:39
What else could it quit?
â Stephen Kitt
May 28 at 13:07
like other control flow contructs such as "if" and external commands? Why are they not mentioned?
â Tim
May 28 at 13:14
External commands deal withSIGINT
themselves (the shell is informed if an external command was killed by a signal, but it deals with that by interpreting the information given bywait(2)
orwaitpid(2)
, not by installing a signal handler).if
etc. run at a point in time, so thereâÂÂs not much point in making them interruptible.
â Stephen Kitt
May 28 at 13:22
add a comment |Â
up vote
2
down vote
accepted
Quoting the bash manual:
When
bash
is interactive, in the absence of any traps, it ignores
SIGTERM
(so thatkill 0
does not kill an interactive shell), and
SIGINT
is caught and handled (so that thewait
builtin is interruptible).
Yes, bash quits builtins when it receives SIGINT
. You can verify that with wait
or read
(read
from a large file with no newlines will give you time to press CtrlC). wait
in particular needs to deal with SIGINT
correctly, as per POSIX (along with all other signals it can come across).
Thanks. Besides loop and builtins, does bash quit anything else?
â Tim
May 28 at 11:39
What else could it quit?
â Stephen Kitt
May 28 at 13:07
like other control flow contructs such as "if" and external commands? Why are they not mentioned?
â Tim
May 28 at 13:14
External commands deal withSIGINT
themselves (the shell is informed if an external command was killed by a signal, but it deals with that by interpreting the information given bywait(2)
orwaitpid(2)
, not by installing a signal handler).if
etc. run at a point in time, so thereâÂÂs not much point in making them interruptible.
â Stephen Kitt
May 28 at 13:22
add a comment |Â
up vote
2
down vote
accepted
up vote
2
down vote
accepted
Quoting the bash manual:
When
bash
is interactive, in the absence of any traps, it ignores
SIGTERM
(so thatkill 0
does not kill an interactive shell), and
SIGINT
is caught and handled (so that thewait
builtin is interruptible).
Yes, bash quits builtins when it receives SIGINT
. You can verify that with wait
or read
(read
from a large file with no newlines will give you time to press CtrlC). wait
in particular needs to deal with SIGINT
correctly, as per POSIX (along with all other signals it can come across).
Quoting the bash manual:
When
bash
is interactive, in the absence of any traps, it ignores
SIGTERM
(so thatkill 0
does not kill an interactive shell), and
SIGINT
is caught and handled (so that thewait
builtin is interruptible).
Yes, bash quits builtins when it receives SIGINT
. You can verify that with wait
or read
(read
from a large file with no newlines will give you time to press CtrlC). wait
in particular needs to deal with SIGINT
correctly, as per POSIX (along with all other signals it can come across).
edited May 28 at 13:09
answered May 28 at 5:24
Stephen Kitt
140k22302363
140k22302363
Thanks. Besides loop and builtins, does bash quit anything else?
â Tim
May 28 at 11:39
What else could it quit?
â Stephen Kitt
May 28 at 13:07
like other control flow contructs such as "if" and external commands? Why are they not mentioned?
â Tim
May 28 at 13:14
External commands deal withSIGINT
themselves (the shell is informed if an external command was killed by a signal, but it deals with that by interpreting the information given bywait(2)
orwaitpid(2)
, not by installing a signal handler).if
etc. run at a point in time, so thereâÂÂs not much point in making them interruptible.
â Stephen Kitt
May 28 at 13:22
add a comment |Â
Thanks. Besides loop and builtins, does bash quit anything else?
â Tim
May 28 at 11:39
What else could it quit?
â Stephen Kitt
May 28 at 13:07
like other control flow contructs such as "if" and external commands? Why are they not mentioned?
â Tim
May 28 at 13:14
External commands deal withSIGINT
themselves (the shell is informed if an external command was killed by a signal, but it deals with that by interpreting the information given bywait(2)
orwaitpid(2)
, not by installing a signal handler).if
etc. run at a point in time, so thereâÂÂs not much point in making them interruptible.
â Stephen Kitt
May 28 at 13:22
Thanks. Besides loop and builtins, does bash quit anything else?
â Tim
May 28 at 11:39
Thanks. Besides loop and builtins, does bash quit anything else?
â Tim
May 28 at 11:39
What else could it quit?
â Stephen Kitt
May 28 at 13:07
What else could it quit?
â Stephen Kitt
May 28 at 13:07
like other control flow contructs such as "if" and external commands? Why are they not mentioned?
â Tim
May 28 at 13:14
like other control flow contructs such as "if" and external commands? Why are they not mentioned?
â Tim
May 28 at 13:14
External commands deal with
SIGINT
themselves (the shell is informed if an external command was killed by a signal, but it deals with that by interpreting the information given by wait(2)
or waitpid(2)
, not by installing a signal handler). if
etc. run at a point in time, so thereâÂÂs not much point in making them interruptible.â Stephen Kitt
May 28 at 13:22
External commands deal with
SIGINT
themselves (the shell is informed if an external command was killed by a signal, but it deals with that by interpreting the information given by wait(2)
or waitpid(2)
, not by installing a signal handler). if
etc. run at a point in time, so thereâÂÂs not much point in making them interruptible.â Stephen Kitt
May 28 at 13:22
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f446378%2fwhen-receiving-sigint-does-bash-also-quit-other-commands-besides-loops-for-or%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password