Skip to content

Instantly share code, notes, and snippets.

@soyuka
Last active September 27, 2019 03:02
Show Gist options
  • Save soyuka/c86dd69cfc85fc12a7cc98d703090d1f to your computer and use it in GitHub Desktop.
Save soyuka/c86dd69cfc85fc12a7cc98d703090d1f to your computer and use it in GitHub Desktop.
#!/bin/bash
pfind() {
ps -e | grep $@ | grep -v grep | awk '{print $1}'
}
killed=0
for pid in $(pfind yabar)
do
kill $pid
killed=1
done
if [ $killed == 0 ]
then
yabar &
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment