Last active
June 15, 2019 04:04
-
-
Save debxp/13f7fea7fc65414b2ce2faef65665c5a to your computer and use it in GitHub Desktop.
Só uma brincadeira com o desafio do 1º Master Dev Brasil
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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