Skip to content

Instantly share code, notes, and snippets.

@amboxer21
Created November 2, 2012 05:01
Show Gist options
  • Save amboxer21/3998810 to your computer and use it in GitHub Desktop.
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.
#!/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