After I have learned that the $$
special variable holds the process number of the shell, I tried too kill the shell by simply: kill <pid obtained by echo $$>
, however this did not work, I also tried some variations, but them also had no effect.

- 72,889

- 26,630
2 Answers
Check the bash manual:
When bash is interactive, in the absence of any traps, it ignores SIGTERM
https://www.gnu.org/software/bash/manual/bashref.html#Signals
Check the kill
help text (help kill
at a bash prompt):
If neither SIGSPEC nor SIGNUM is present, then SIGTERM is assumed.
https://www.gnu.org/software/bash/manual/bashref.html#index-kill

- 85,964
You can, but the shell tries hard not to die unless it's absolutely sure that's what is required.
SIGHUP works (as does SIGKILL), and you can try this -
kill -HUP $$
(If you prefer numeric signal identifiers the HUP
can be replaced with 1
.)
The reason that SIGHUP
works is that this is the signal that would have been sent when a serial line connection over a modem was terminated - for instance if the phone line was hung up.

- 116,213
- 16
- 160
- 287
kill $$
(although it won't work, as explained in link above). And you should copy paste the text instead of posting a screenshot. – Leiaz Feb 21 '15 at 20:34