Add a Yes/No function
This commit is contained in:
parent
8984180787
commit
7160d3c6a5
|
@ -158,6 +158,17 @@ function message_box {
|
|||
dialog --title "$1" --msgbox "$2" 0 0
|
||||
}
|
||||
|
||||
function yesno_box {
|
||||
# yesno_box "title" "prompt" VARIABLE
|
||||
# The exit code resembles the user's input and will be stored in the variable VARIABLE
|
||||
# Temporarily turn off 'set -e' because we need the dialog return code
|
||||
declare -n result=$3
|
||||
set +e
|
||||
dialog --stdout --title "$1" --yesno "$2" 0 0
|
||||
result=$?
|
||||
set -e
|
||||
}
|
||||
|
||||
function input_box {
|
||||
# input_box "title" "prompt" "defaultvalue" VARIABLE
|
||||
# The user's input will be stored in the variable VARIABLE.
|
||||
|
|
Loading…
Reference in New Issue