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.
 
 
 
 
 
 

36 lignes
770 B

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