Sample Header Ad - 728x90

bash - How can I re-display selection menu after a selection is chosen and performed

10 votes
6 answers
23532 views
I am making a tool script for my theme with 2 functions: Check for update, reinstall theme So here is the code for selection menu: PS3='Choose an option: ' options=("Check for update" "Reinstall theme") select opt in "${options[@]}" do case $opt in "Check for update") echo "Checking update" ;; "Reinstall theme") echo "Reinstalling" ;; *) echo invalid option;; esac done When running it appear like this 1) Check for update 2) Reinstall theme Choose an option: I type 1 and enter, the check for update command is performed The problem is when it finished performing the script, it re-display "Choose an option:" not with the menu. So it can make users hard to choose without the menu (especially after a long script) 1) Check for update 2) Reinstall theme Choose an option: 1 Checking update Choose an option: So how can I re-display the menu after an option is performed
Asked by superquanganh (4041 rep)
Jul 1, 2016, 04:39 PM
Last activity: May 25, 2024, 07:15 PM