mirror of
https://github.com/hydroxycarbamide/dotfiles.git
synced 2025-05-07 13:29:08 -04:00
Add nnn
This commit is contained in:
parent
0ef5de12ac
commit
c0889285ff
58 changed files with 5175 additions and 0 deletions
35
dot_config/nnn/plugins/executable_pskill
Normal file
35
dot_config/nnn/plugins/executable_pskill
Normal file
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
# Description: Fuzzy list and kill a (zombie) process by name
|
||||
#
|
||||
# Dependencies: fzf, ps
|
||||
#
|
||||
# Note: To kill a zombie process enter "zombie"
|
||||
#
|
||||
# Shell: POSIX compliant
|
||||
# Author: Arun Prakash Jana
|
||||
|
||||
printf "Enter process name ['defunct' for zombies]: "
|
||||
read -r psname
|
||||
|
||||
# shellcheck disable=SC2009
|
||||
if [ -n "$psname" ]; then
|
||||
if type sudo >/dev/null 2>&1; then
|
||||
sucmd=sudo
|
||||
elif type doas >/dev/null 2>&1; then
|
||||
sucmd=doas
|
||||
else
|
||||
sucmd=: # noop
|
||||
fi
|
||||
|
||||
if type fzf >/dev/null 2>&1; then
|
||||
fuzzy=fzf
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cmd="$(ps -ax | grep -iw "$psname" | "$fuzzy" | sed -e 's/^[ \t]*//' | cut -d' ' -f1)"
|
||||
if [ -n "$cmd" ]; then
|
||||
$sucmd kill -9 "$cmd"
|
||||
fi
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue