script-kill.sh 212 B

12345678910
  1. #!/usr/bin/env bash
  2. set -euo pipefail # bash strict mode
  3. ps -eo pid,euser,comm | grep -i "$1"
  4. if [ "$?" -eq 0 ];then
  5. pkill "$(ps -eo pid,comm | pgrep -i "$1")"
  6. else
  7. echo There is no process like this
  8. fi