Created
November 2, 2012 05:01
-
-
Save amboxer21/3998810 to your computer and use it in GitHub Desktop.
A refined killall command for Arch. Since killall doesn't properly work for me.
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
#!/bin/bash | |
if (( $# != 1 )) ; then | |
echo -e "USAGE: $0 program"; | |
fi | |
# For use with Debian | |
# Instead use -> exists=$(dpkg -s $1 | awk -F: '/Package:/{print $2}' | sed 's/^[ \t]*//'); | |
exists=$(pacman -Q $1 | awk '{ print $1}'); | |
if (( $exists == $1 )) ; then | |
running=$(pgrep $1); | |
if (( $running )) ; then | |
kill -9 $running | |
else echo "$1 is not running."; | |
exit; | |
fi | |
fi 2> /dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment