-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathupdated.sh
More file actions
44 lines (42 loc) · 860 Bytes
/
updated.sh
File metadata and controls
44 lines (42 loc) · 860 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
echo -e "\n----List Of Running Processes----\n"
ps r o pid,user,group,%mem,%cpu,stat # list of running process
echo -e "\n--------------------------------\n"
A=1
while [ $A != 0 ]
do
echo -e "\n1 : Display detail of a process"
echo 2 : Terminate a process
echo 3 : Exit
A=1
echo -e "\n enter choice :"
read choice
err='err'
case $choice in
1 ) echo enter PID
read pid
echo ----------------------------
ps o pid,user,group,%mem,%cpu $pid
echo ----------------------------
err=$(echo $?)
if [ "$err" != 0 ]
then
echo *********** Invalid PID ************
fi
;;
2 ) echo enter PID
read pid
echo -----------------------------
kill $pid
err=$(echo $?)
if [ "$err" != 0 ]
then
echo *********** Invalid PID / Permission ************
fi
;;
3 ) echo exit
A=0
;;
* ) echo enter correct option
esac
done