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.