bash: kill $$ not work?
bash, kill, linux
Solution
I'm not sure why one would like to `kill` the current shell. Nevertheless...
`kill PID` would send `SIGTERM` when no signal is specified. `bash` ignores `SIGTERM` and `SIGQUIT` in the absence of any traps.
You'll achieve the desired effect if you were to say
kill -9 $$
or
kill -SIGKILL $$
Quoting from the manual:
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). When Bash receives a `SIGINT`, it breaks out of any executing loops. In all cases, Bash ignores `SIGQUIT`.
Problem
The command `kill $$` should kill current bash, but it seems that it doesn't work: ``` $ ps -p $$ PID TTY TIME CMD 18179 pts/4 00:00:00 bash $ kill $$ $ ps -p $$ PID TTY TIME CMD 18179 pts/4 00:00:00 bash ``` Why?