Варианты меню в скпритах на bash
Вариант 1:
#!/bin/bash # customize with your own. options=("AAA" "BBB" "CCC" "DDD") menu() { echo "Avaliable options:" for i in ${!options[@]}; do printf "%3d%s) %s\n" $((i+1)) "${choices[i]:- }" "${options[i]}" done if [[ "$msg" ]]; then echo "$msg"; fi } prompt="Check an option (again to uncheck, ENTER when done): " while menu && read -rp "$prompt" num && [[ "$num" ]]; do [[ "$num" != *[![:digit:]]* ]] && (( num > 0 && num <= ${#options[@]} )) || { msg="Invalid option: $num"; continue; } ((num--)); msg="${options[num]} was ${choices[num]:+un}checked" [[ "${choices[num]}" ]] && choices[num]="" || choices[num]="+" done printf "You selected"; msg=" nothing" for i in ${!options[@]}; do [[ "${choices[i]}" ]] && { printf " %s" "${options[i]}"; msg=""; } done echo "$msg"
https://serverfault.com/questions/144939/multi-select-menu-in-bash-script
Вариант 2.
#!/bin/bash DISTROS=$(whiptail --title "Test Checklist Dialog" --checklist \ "Choose preferred Linux distros" 15 60 4 \ "debian" "Venerable Debian" ON \ "ubuntu" "Popular Ubuntu" OFF \ "centos" "Stable CentOS" ON \ "mint" "Rising Star Mint" OFF 3>&1 1>&2 2>&3) exitstatus=$? if [ $exitstatus = 0 ]; then echo "Your favorite distros are:" $DISTROS else echo "You chose Cancel." fi