My build of nnn with minor changes
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 
 
 
 

31 lignes
648 B

  1. #!/usr/bin/env sh
  2. # Description: Fuzzy list and kill a (zombie) process by name
  3. #
  4. # Note: To kill a zombie process enter "zombie"
  5. #
  6. # Shell: POSIX compliant
  7. # Author: Arun Prakash Jana
  8. is_cmd_exists () {
  9. which "$1" > /dev/null 2>&1
  10. echo $?
  11. }
  12. if [ "$(is_cmd_exists sudo)" -eq "0" ]; then
  13. sucmd=sudo
  14. elif [ "$(is_cmd_exists doas)" -eq "0" ]; then
  15. sucmd=doas
  16. else
  17. sucmd=: # noop
  18. fi
  19. printf "Enter process name ['defunct' for zombies]: "
  20. read -r psname
  21. if ! [ -z "$psname" ]; then
  22. # shellcheck disable=SC2009
  23. cmd="$(ps -ax | grep -iw "$psname" | fzy | sed -e 's/^[ \t]*//' | cut -d' ' -f1)"
  24. $sucmd kill -9 "$cmd"
  25. fi