Skip to content

Instantly share code, notes, and snippets.

@debxp
Last active June 15, 2019 04:04
Show Gist options
  • Save debxp/13f7fea7fc65414b2ce2faef65665c5a to your computer and use it in GitHub Desktop.
Save debxp/13f7fea7fc65414b2ce2faef65665c5a to your computer and use it in GitHub Desktop.
Só uma brincadeira com o desafio do 1º Master Dev Brasil
#!/usr/bin/env bash
# Vídeo da live:
# https://www.youtube.com/watch?v=HM1aBrhcj9c
# Requer: dmenu
selected="$(ps -a -u $USER | \
dmenu -i -l 20 -p "Select process to kill" | \
awk '{print $1" "$4}')";
if [[ ! -z $selected ]]; then
selpid="$(awk '{print $1}' <<< $selected)";
kill -9 $selpid
fi
exit 0
# A mesma solução em uma linha...
ps -a -u $USER | awk '{print $1" "$4}' | dmenu -l 20 | awk '{print $1}' | xargs -r kill -9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment