Ceate a yes/no dialog box to verify user entries

by jonathan adams   Last Updated November 08, 2018 23:02 PM

I am writing a bash script that prompts for for several user entries prior to the start of the script. I am looking for the best way to use dialog to have the users verify the information. I am trying to modify the example below:

# dynbox.sh - Yes/No box demo
dialog --title "Delete file" \
--backtitle "Linux Shell Script Tutorial Example" \
--yesno "Are you sure you want to permanently delete \"/tmp/foo.txt\"?" 7 60

# Get exit status
# 0 means user hit [yes] button.
# 1 means user hit [no] button.
# 255 means user hit [Esc] key.
case $response in
0) echo "File deleted.";;
1) echo "File not deleted.";;
255) echo "[ESC] key pressed.";;

I am running it to some errors though when trying to create it. Basically I want a yes/no dialog box to say

Please verify your entered information:
Install SSL : $InstallSSL
Domain Name : $DomainName

the left side will be static text where the right will display the variable.

Tags : bash dialog

Answers 1

You can include newlines in a double quoted string which also expands variables:

dialog --title "Verification" \
--yesno "Please verify your entered information:
Install SSL : $InstallSSL
Domain Name : $DomainName" 7 60
November 08, 2018 22:22 PM

Related Questions

How to get dialog box input directed to a variable?

Updated December 01, 2015 15:01 PM

Bash Dialog Menu Leaves Menu

Updated April 07, 2017 16:02 PM

How to use checklist menu in dialog?

Updated October 19, 2018 11:02 AM

Simple GUI for various bash command

Updated March 15, 2017 15:02 PM