Skip to content

Instantly share code, notes, and snippets.

@sisco70
Created May 31, 2021 22:40
Show Gist options
  • Save sisco70/528806ecdca813672f7e0970aeb384b5 to your computer and use it in GitHub Desktop.
Save sisco70/528806ecdca813672f7e0970aeb384b5 to your computer and use it in GitHub Desktop.
Bash dialog with return values (esc, extra button) using pipes redirection
check_return_value() {
retval=$?
case $retval in
0|3) return ;;
*) clear
prompt -i "\n Operation canceled by user, Bye!"
exit 1 ;;
esac
}
choice=$(dialog --backtitle ${Project_Name} \
--no-tags --extra-button --extra-label "Remove" \
--radiolist "Choose your Grub theme : " 15 40 5 \
"vimix" "Vimix Theme" off \
"tela" "Tela Theme" on \
"stylish" "Stylish Theme" off \
"slaze" "Slaze Theme" off \
"whitesur" "WhiteSur Theme" off \
3>&1 1>&2 2>&3 3>&-)
check_return_value
echo $choice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment