1

I'm trying some things with my shell. This includes the following command:

kill $$

My expectation was that the shell would log me out and terminate itself. But instead the bash persists without change.

Any idea why?
I ran this command on different environments (archlinux, debian). The behavior was always the same.

-2

The shell catches many signals and this applies to SIGTERM as well, which is the default signal send by kill.

If you really like to terminate the shell via kill, use kill -KILL $$.

1

After some searching I found some statement:

When bash is interactive, in the absence of any traps, it ignores SIGTERM (so that kill 0 does not kill an interactive shell), and SIGINT is caught and handled (so that the wait builtin is interruptible). In all cases, bash ignores SIGQUIT. If job control is in effect, bash ignores SIGTTIN, SIGTTOU, and SIGTSTP

So that fact that I have a interactive shell simple let the bash ignore the signal.

Thanks for the help anyway!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.