0

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. enter image description here

muru
  • 72,889
  • 2
    xargs 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. – jasonwryan Feb 21 '15 at 21:04

2 Answers2

3

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

glenn jackman
  • 85,964
2

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.

Chris Davies
  • 116,213
  • 16
  • 160
  • 287