Improve killp function

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2018-02-10 12:31:51 +01:00
parent e2ce3fef06
commit 31ff83ba68
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -3,7 +3,11 @@ function exists { which $1 &> /dev/null }
# kill process
function peco-kill-process() {
ps ax -o pid,time,command | peco --query "$LBUFFER" | awk '{print $1}' | xargs kill
local procs
procs=$(ps ax -o pid,user,time,command | peco --query "$LBUFFER" | awk '{print $1}')
if [ -n "${procs}" ]; then
echo "${procs}" | xargs kill
fi
}
alias killp='peco-kill-process'