Building Menu with the SADMIN Menu Builder template script (sadm_template_menu.sh)


We have included four templates that are ready to use :
  1. The Shell script template ($SADMIN/bin/sadm_template.sh).
  2. The Python script template ($SADMIN/bin/sadm_template.py).
  3. The Terminal Menu builder template ($SADMIN/bin/sadm_template_menu.sh).
  4. The SADMIN wrapper script allowing you to run existing script and benefit of the SADMIN tools ($SADMIN/bin/sadm_wrapper.sh).

The best way to become familiar the menu builder, is to run the "sadm_template_menu.sh" script.
# sadm_template_menus.sh




Here is some portion of the code in "sadm_template_menu.sh", you want to modify to create your own menu.


    # Display Main Menu     
        while :
            do
            sadm_display_heading "Your Menu Heading Here"               # Std SADMIN Menu Heading
            menu_array=("Your Menu Item 1" "Your Menu Item 2" "Your Menu Item 3" "Your Menu Item 4" )             
            sadm_display_menu "${menu_array[@]}"                        # Display menu Array
            sadm_choice=$?                                              # Choice is returned in $?
            case $sadm_choice   in                                            
                1) sadm_mess "You press choice number $sadm_choice"
                ;;
                2) sadm_mess "You press choice number $sadm_choice"
                ;;
                3) sadm_mess "You press choice number $sadm_choice"
                ;;
                4) sadm_mess "You press choice number $sadm_choice"
                ;;
            99) # Option Quit -                                         # 99 = [Q],[q] was pressed
                break                                                   # Break out of the loop
                ;;
                *) # Invalid Option #                                   # If an invalid key press
                sadm_mess "Invalid option"                              # Message to user
                ;;
            esac
            done

Copyright © 2015-2019 - www.sadmin.ca - Suggestions, Questions or Report a problem at support@sadmin.ca