 kill is generally impolite it does not allow the target a chance to clean up for ssh  the following should be sufficient kill ssh pid if you have got some reason to believe that ssh may occasionally fail to quit  you can do something like this kill ssh pid sleep kill  kill ssh pid true