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

  1. i=0
  2. while [ $i != 6 ]
  3. do
  4. echo "Menu
  5. 1. Display calender of current Month
  6. 2. Display today's date and time
  7. 3. Display usernames of those who are currently logged in the ststem
  8. 4. Display your name at given x, y position
  9. 5. Display Terminal Number
  10. 6. Exit
  11. Choose your option and enter corresponding value"
  12.  
  13. read i
  14. case "$i" in
  15. 1) calender="$(cal)"
  16. echo "Here is your Calender "
  17. echo "$calender"
  18. ;;
  19. 2) current="$(date)"
  20. echo "Current Date and Time is " "$current"
  21. ;;
  22. 3) username="$(whoami)"
  23. echo "Currently logged in users : "
  24. echo $username
  25. ;;
  26. 4)
  27. ;;
  28. 5)
  29. ;;
  30. esac
  31. done

Code for the option 4 and 5 will be updated soon

Interpreting the menu_pr.sh file and executing it in terminal

  1. tkanu025@hp:~/lab_solutions$ chmod +x menu_pr.sh
  2. tkanu025@hp:~/lab_solutions$ ./menu_pr.sh
Output
cse gtu free study material for gtu engineering students operating system programs
cse gtu free study material for gtu engineering students operating system programs
cse gtu free study material for gtu engineering students operating system programs

gtu os lab manual,

os GTU Practical,

operating system Programs,

Operating system shellscript programs,

Gtu study material 3140705,

OS 3140702,

os practical list,

shell script programming,

gtu os practical,

os lab solution gtu

Comments

Parth shah said…
please can you share with me the whole code for practical 7?

YouTube

Popular posts from this blog

GTU OS Program - 11 Filters

GTU OS Program - 13 Date Validator

GTU OS Program - 8