EXPECTED_ARGS=1
if [ $# -ne $EXPECTED_ARGS ]
then
echo "Usage: appkill.sh [application name]"
exit 0
fi
pid=`ps -el | grep $1 | awk '{print $4}'`
echo $pid
kill -9 $pid
Save it as, say appkill.sh . Now make the file executable using the following command
$> chmod +x appkill.sh
Now one can kill any application by giving its name as an argument to the script
$> appkill.sh applicationname
Example: To kill firefox use
$> appkill.sh firefox
No comments:
Post a Comment