Created
May 31, 2021 22:40
-
-
Save sisco70/528806ecdca813672f7e0970aeb384b5 to your computer and use it in GitHub Desktop.
Bash dialog with return values (esc, extra button) using pipes redirection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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