remove_old_programs.bash 333 Bytes
Newer Older
Rohit Gupta's avatar
Rohit Gupta committed
1
2
3
#!/bin/bash

#$1 programs to be killed and checked
4
5
echo "removing old programs..."
echo "args = $1"
Rohit Gupta's avatar
Rohit Gupta committed
6
7
8
echo "programs to be killed"
ps -aux |grep -E -i $1

Rohit Gupta's avatar
Rohit Gupta committed
9
ps -aux |grep -E -i $1| awk '{print $2}' | sudo xargs kill -9 
Rohit Gupta's avatar
Rohit Gupta committed
10
11

var=`ps -aux |grep -E -i $1`
Rohit Gupta's avatar
Rohit Gupta committed
12
13
14
echo $var
if [ -n "$var" ]; then echo 'Match found'; else echo 'Match not found' ;fi