Advertisement
Jackspade9624

menue examples

Apr 19th, 2025
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Define the menu options
  4. menu_options=("Option 1" "Option 2" "Option 3" "Quit")
  5.  
  6. # Set the menu prompt
  7. PS3="Choose an option: "
  8.  
  9. # Create the menu using the select command
  10. select name in "${menu_options[@]}"; do
  11. case $name in
  12. "Option 1")
  13. echo "You chose Option 1"
  14. ;;
  15. "Option 2")
  16. echo "You chose Option 2"
  17. ;;
  18. "Option 3")
  19. echo "You chose Option 3"
  20. ;;
  21. "Quit")
  22. echo "Exiting the menu"
  23. break # Exit the loop
  24. ;;
  25. *)
  26. echo "Invalid choice. Please try again."
  27. ;;
  28. esac
  29. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement