mirror of
https://github.com/mail-in-a-box/mailinabox.git
synced 2026-03-11 16:57:23 +01:00
simplify the input_box function
This commit is contained in:
@@ -134,21 +134,11 @@ function message_box {
|
||||
}
|
||||
|
||||
function input_box {
|
||||
TMP=`mktemp`
|
||||
dialog --title "$1" --inputbox "$2" 0 0 "$3" 2>$TMP
|
||||
|
||||
respose=$?
|
||||
|
||||
case $respose in
|
||||
0)
|
||||
result=$(<$TMP)
|
||||
;;
|
||||
1)
|
||||
exit
|
||||
;;
|
||||
255)
|
||||
exit
|
||||
esac
|
||||
|
||||
rm $TMP
|
||||
# input_box "title" "prompt" "defaultvalue" VARIABLE
|
||||
# The user's input will be stored in the variable VARIABLE.
|
||||
# The exit code from dialog will be stored in VARIABLE_EXITCODE.
|
||||
declare -n result=$4
|
||||
declare -n result_code=$4_EXITCODE
|
||||
result=$(dialog --stdout --title "$1" --inputbox "$2" 0 0 "$3")
|
||||
result_code=$?
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user