Killing a process using sh and bash -


I have to kill a process by using the same command in sh and bash (in a script). Normally I will do the following:

  SCRIPT = $ (basename $ 0) #So script kills itself killall-9 $ SCRIPT # own only   

Though it does not appear to be used in SAH

Any suggestions on any solution that will work in either.

Is there a simpler or more correct way to get a script completely out of place? I have repeatedly revisited this question many times and have never been officially found in the right way.

Let the script kill itself, point it to $$ which Presents Shell's process ID.

  kill "$$" "$$"   

Avoid SIGKILL ( 9 ) when not necessary only Use it on applications that do not respond significantly.

The default signal sent is SIGTERM (15), and there are other signals that can also end the process which can be safer than the SIGKILL. One of these is Siguquit, Sigabert, and SIGHUP.

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -