GTU OS Program - 7
7. Write a menu driven shell script which will print the following menu and
execute the given task. MENU
1) Display calendar of current month
2) Display today’s date and time
3) Display usernames those are currently logged in the system
4) Display your name at given x, y position
5) Display your terminal number
6) Exit
Complete code of the program
i=0 while [ $i != 6 ] do echo "Menu 1. Display calender of current Month 2. Display today's date and time 3. Display usernames of those who are currently logged in the ststem 4. Display your name at given x, y position 5. Display Terminal Number 6. Exit Choose your option and enter corresponding value" read i case "$i" in 1) calender="$(cal)" echo "Here is your Calender " echo "$calender" ;; 2) current="$(date)" echo "Current Date and Time is " "$current" ;; 3) username="$(whoami)" echo "Currently logged in users : " echo $username ;; 4) ;; 5) ;; esac done
Code for the option 4 and 5 will be updated soon
Interpreting the menu_pr.sh file and executing it in terminal
tkanu025@hp:~/lab_solutions$ chmod +x menu_pr.sh tkanu025@hp:~/lab_solutions$ ./menu_pr.sh
Output
Comments