#!/bin/bash # Function to display the menu using whiptail show_menu() { while true; do CHOICE=$(whiptail --title "Main Menu" \ --menu "Choose an option:" 15 60 4 \ "1" "Option 1" \ "2" "Option 2" \ "3" "Option 3" \ "4" "Exit" 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus != 0 ]; then echo "Menu cancelled." exit 1 fi case $CHOICE in 1) whiptail --title "Option 1" --msgbox "You selected Option 1" 8 45 ;; 2) whiptail --title "Option 2" --msgbox "You selected Option 2" 8 45 ;; 3) whiptail --title "Option 3" --msgbox "You selected Option 3" 8 45 ;; 4) clear echo "Goodbye!" exit 0 ;; esac done } # Check if whiptail is installed if ! command -v whiptail &> /dev/null; then echo "Error: whiptail is not installed" echo "Please install it using: sudo apt-get install whiptail" exit 1 fi # Clear the screen and show the menu clear show_menu