Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a menu driven shell linux script program on the system to do the following

ID: 3882473 • Letter: W

Question

Write a menu driven shell linux script program on the system to do the following tasks:
Please use the needed grep and cut commands to get the specific names please.

1. Display the IP address and the name of the machine only

2. Display all users currently on the system (id and full name only)

3. Display the server IP address, the netmask, and the broadcast addresses only

4. Enter user’s login id and display all processes belong to the entered id

5. Count how many login IDs on the server

6. Exit Program

Enter selection: _

Note: Your program should run forever until the user chooses to quit - (option 6).

Explanation / Answer

show menu(){

echo "menu"

echo "enter 1 ip address name"

echo "enter 2 users"

echo " enter 3 netmask broadcast"

echo "enter 4 login id process"

echo "enter 5 login id"

echo "enter 6 exit"

read -p "please select a number in menu" i

return $i

}

while [["$i"!="6"]]

do if[["$i"=="1"]];then

echo $USER

ip addr show |grep -w inet|grep -v 127.0.0.1|awk '{print $2}'|cut -d "/" -f1

elif [["$i"=="2"]];then

who

elif [["$i"=="3"]];then

echo "mask ip"

ip addr show|grep -w inet|grep -v 127.0.0.1|awk '{print $2}'|cut -d "/" -f2

echo "broadcast ip"

ip addr show|grep -w inet|grep -v 127.0.0.1|awk '{print $4}'

elif [["i"=="4"]];then

echo "user id"

echo $uid

echo "process"

ps -el|grep -i $uid

elif [["i"=="5"]];then

log= who| wc -l

echo "$log"

fi

show menu

done

i=$?

exit;;

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote