I'm trying to figure a way to escape spaces in a string so I can put together a variable to use for the dialog command (since I have a few screens and I want to use the same setup for each screen). Thing is, if I put a string with spaces in, it thinks it's two parameters and not a string!
I tried everything I could think of and can't get it to work. I've tried escaping the space, escaping quotes, single quoting the string, nothing seems to work. I'm grasping straws. Anyone know how to fix this?
#!/bin/bash
DIALOG=${DIALOG=dialog --colors --title "\Z0Login Information\Zn"}
$DIALOG --ok-label "Submit" \
--backtitle "My Configuration" \
--insecure "$@" \
--colors --mixedform "Enter the login information:\n\n\Z1Use arrow keys and TAB to navigate.\nPress ENTER to cancel.\Zn\n" \
22 100 0 \
" Your Username:" 1 1 "" 1 27 150 0 0 \
" Your Password:" 3 1 "" 3 27 150 0 1 \
" Verify Password:" 4 1 "" 4 27 150 0 1
It gives me "Error: Unknown option Information\Zn."
instead of a dialog box if I try to run it. If I remove the space in "Login Information"
(ie. use "LoginInformation" instead, which is not how I want to present it), it works.