Skip to main content
added 133 characters in body
Source Link
John B
  • 109
  • 1

BASH

kill -9 $BASHPID 

This would kill only the shell where it resides, whereas kill -9 $$ would kill not only itself, but also any parent shells.

From BASH man page:

Expands to the process ID of the current bash process. This differs from $$ under certain circumstances, such as subshells that do not require bash to be re-initialized.

Expands to the process ID of the current bash process. This differs from $$ under certain circumstances, such as subshells that do not require bash to be re-initialized.

BASH

kill -9 $BASHPID 

From BASH man page:

Expands to the process ID of the current bash process. This differs from $$ under certain circumstances, such as subshells that do not require bash to be re-initialized.

BASH

kill -9 $BASHPID 

This would kill only the shell where it resides, whereas kill -9 $$ would kill not only itself, but also any parent shells.

From BASH man page:

Expands to the process ID of the current bash process. This differs from $$ under certain circumstances, such as subshells that do not require bash to be re-initialized.

some ignoramus downvoted my perfectly valid answer after stealing my idea...scumbag
Source Link
John B
  • 109
  • 1

BASH

Got the idea from BASH man page

kill -9 $BASHPID 

From BASH man page:

Expands to the process ID of the current bash process. This differs from $$ under certain circumstances, such as subshells that do not require bash to be re-initialized.

BASH

Got the idea from BASH man page

kill -9 $BASHPID 

BASH

kill -9 $BASHPID 

From BASH man page:

Expands to the process ID of the current bash process. This differs from $$ under certain circumstances, such as subshells that do not require bash to be re-initialized.

added 11 characters in body
Source Link
John B
  • 109
  • 1

BASH

Uses internal variableGot the idea from BASH man page

kill -9 $BASHPID 

BASH

Uses internal variable

kill -9 $BASHPID 

BASH

Got the idea from BASH man page

kill -9 $BASHPID 
Source Link
John B
  • 109
  • 1
Loading