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.

- 69,900
- 13
- 192
- 292
- 25,760
- 23
- 64
- 88
-
2xargs is totally overkill here. Just use `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
-
I wanted to copy paste first, but once I tried , I got a total unformatted character mess. – Abdul Al Hazred Feb 21 '15 at 20:57
-
As with every one of your other questions, this one exhibits no effort to search: either for previous questions or how to format text on the site. Please stop being such a [help vampire](http://slash7.com/2006/12/22/vampires/). – jasonwryan Feb 21 '15 at 21:04
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
- 84,176
- 15
- 116
- 168
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.
- 107,089
- 14
- 139
- 261