Created
June 12, 2014 10:31
-
-
Save honbin/bd7c6aa6b8acbb70e2ac to your computer and use it in GitHub Desktop.
プロセス殺したいとき
This file contains hidden or 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 | |
PS=`pgrep -lf "${1:?引数に殺したいプロセス名を渡してね}"` | |
echo $PS | |
if [ -z "${PS}" ]; then | |
echo "殺したいプロセス名は存在しないようですね、ウィー" | |
exit 1 | |
fi | |
echo "これらのプロセスを殺してもよろしいですか? [Y/n]" | |
read ANSWER | |
case `echo $ANSWER | tr y Y` in | |
"" | Y* ) { | |
pkill -f "${1}" | |
echo "ヒーハー!!" | |
};; | |
* ) echo "フー!!";; | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment