Practical
no-6:shells script to check and list attributes of process
#!/bin/bash
echo "1.displays PID of go login
shell"
echo "2. displays process status"
echo "3. detail listing process"
echo "4. display process of user"
echo "5. display all user process"
echo "6. display system process"
printf "enter choice:"
read choice
if [ $choice==1 ]
then
echo " PID of curent shell is:$"
fi
if
[ $choice==2 ]
then
ps
fi
if
[ $choice==3 ]
then
ps -f
fi
if
[ $choice==4 ]
then
printf "enter username"
read user
ps -u $user
fi
if
[ $choice==5 ]
then
ps -a
fi
if
[ $choice==6 ]
then
ps -e
fi
this
produces the following output:
1.
displays PID of go login shell
2.
displays process status
3.
detail listing process
4.
display process of user
5.
display all user process
6.
display system process
enter
choice:2
PID TTY TIME CMD
6738 pts/6
0:00 first_one
6739 pts/6
0:00 second_one
6770 pts/6
0:01 third_one
No comments:
Post a Comment