-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnuke.sh
More file actions
executable file
·30 lines (22 loc) · 847 Bytes
/
nuke.sh
File metadata and controls
executable file
·30 lines (22 loc) · 847 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env bash
## By Davoud Arsalani
## https://github.com/davoudarsalani/scripts
## https://github.com/davoudarsalani/scripts/blob/master/nuke.sh
## https://raw.githubusercontent.com/davoudarsalani/scripts/master/nuke.sh
## https://davoudarsalani.ir
## https://revelry.co/terminal-workflow-fzf/
## https://github.com/junegunn/fzf/wiki/examples
source ~/main/scripts/utils.sh
IFS=$'\n'
if (( UID > 0 )); then
readarray -t processes < <(ps -f -u "$UID")
else
readarray -t processes < <(ps -ef)
fi
fzf__title=''
process="$(pipe_to_fzf "${processes[@]}")" && wrap_fzf_choice "$process" || exit 37
process="$(printf '%s\n' "$process" | awk '{print $2}')"
kill_prompt="$(get_input "kill ${process}?")" && printf '\n'
case "$kill_prompt" in
y ) [ "$process" ] && printf '%s\n' "$process" | xargs -ro kill -9 ;;
esac