added an excluder to psfind, fixed arg processing
[feisty_meow.git] / scripts / processes / pszap.sh
1 #!/bin/bash
2 if [ -z "$1" ]; then
3   echo "Did not find a parameter to seek out and whack from the process list."
4   exit 2
5 fi
6
7 source "$FEISTY_MEOW_SCRIPTS/core/launch_feisty_meow.sh"
8
9 SCRIPT_NAME="pszap.sh"
10
11 PIDLIST=$(psfind -x $SCRIPT_NAME $1)
12 #echo "PIDS are $PIDLIST"
13 if [ -z "$PIDLIST" ]; then
14   echo "Your process name was not found in the system."
15   exit 1
16 fi
17 echo "Here are the processes matching your pattern:"
18 ps $PIDLIST
19 echo "Are you sure you want to kill all of these? [y/N] "
20 read answer
21 if [ "$answer" = "Y" -o "$answer" = "y" ]; then
22   kill -9 $PIDLIST
23 else
24   echo "You chose not to zap the processes."
25 fi
26