Improve killp function
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
e2ce3fef06
commit
31ff83ba68
1 changed files with 5 additions and 1 deletions
|
@ -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'
|
||||
|
||||
|
|
Loading…
Reference in a new issue