dialog input box

hi,

i want to set a dialog input box in my shells like on linux.
actually i "read" all important informations via read -p "name" NAME.
now i want to have a dialog input box in it like the sysinstall box where i can input a ftp-address i hope you know what i mean my english isnt good at all ..

via bash this works


Code:
dialog --clear --inputbox "Input your password" 10 60 2> password.tml  

clear       
echo "Password: `cat password.tmp`"

exit 0

but i dont wont to save these informations in the .tmp file
 
Are you using csh or tcsh as your shell?

This works if I run it in /bin/sh shell:

$ dialog --inputbox "Enter your name" 10 60 2>temp.txt
 
graudeejs said:
What is your goal?

It is just beautiful, but i dont want that the inputbox save the entering text in a "temp" file, just like read, so i want that the dialog save the text in the cache, like "read"

kpa said:
Are you using csh or tcsh as your shell?

This works if I run it in /bin/sh shell:

$ dialog --inputbox "Enter your name" 10 60 2>temp.txt

Yes, this runs in /bin/sh shell.
 
Wolfi83 said:
It is just beautiful, but i dont want that the inputbox save the entering text in a "temp" file, just like read, so i want that the dialog save the text in the cache, like "read"

I mean, where are you going to use it?
 
graudeejs said:
I mean, where are you going to use it?

If i ask a question in a shell like:

Please enter your mysql password
please enter the full pfad
please enter the ftp pfad

these things ..
 
So, just read the info from the file into a variable.

Code:
choice=$( cat temp.txt )

Now you can manipulate it any way you like by using the variable ${choice}.
 
DutchDaemon said:
So, just read the info from the file into a variable.

Code:
choice=$( cat temp.txt )

Now you can manipulate it any way you like by using the variable ${choice}.

If i have 3 dialogs and i write the 3 informations in a file how i can get the information in line 1, line 2 and line 3?
so if i ask
Code:
"enter mysql user" 2> mysql.tmp
"enter mysql pass" 2> mysql.tmp
"enter mysql host" 2> mysql.tmp
 
Really? You think you're stuck on using one file name for everything?

Code:
"enter mysql user" 2> mysqluser.tmp
"enter mysql pass" 2> mysqlpass.tmp
"enter mysql host" 2> mysqlhost.tmp

Code:
mysqluser=$( cat mysqluser.tmp )
mysqlpass=$( cat mysqlpass.tmp )
mysqlhost=$( cat mysqlhost.tmp )
 
DutchDaemon said:
Really? You think you're stuck on using one file name for everything?

Code:
"enter mysql user" 2> mysqluser.tmp
"enter mysql pass" 2> mysqlpass.tmp
"enter mysql host" 2> mysqlhost.tmp

Code:
mysqluser=$( cat mysqluser.tmp )
mysqlpass=$( cat mysqlpass.tmp )
mysqlhost=$( cat mysqlhost.tmp )

This way is of couse ok, too lol i dont get this idea :stud
 
hi,

how can i get the password in a query like this now?

Code:
PASS="mysqlpass"
USER=$( cat mysqluser.tmp )
HOST=$( cat mysqlhost.tmp )
NEWPASS=$( cat mysqluserpass.tmp )

mysql -u root -p$PASS -e "GRANT ALL PRIVILEGES ON *.* TO '$USER'@'$HOST' IDENTIFIED BY '$NEWPASS';"

$PASS is the actually password of user root.

Thanks a lot
 
One last question!!

If i enter a password in the dialog, i want that the password is hidden.
So not like "Please enter your password" - "mysqlpassword"
Like "Please enter your password" - "*********"

Thanks
 
dialog in FreeBSD 9 has the option --passwordbox. I don't see it in FreeBSD 8 yet.

Code:
┌──────────────────┐
│ 10               │
│ ┌──────────────┐ │
│ │              │ │
│ └──────────────┘ │
│                  │
│                  │
├──────────────────┤
│<  OK  > <Cancel> │
└──────────────────┘

It doesn't print anything (not even **).
 
Or you'll just have to leave dialog alone for the password entry, and use a bit of shell script. e.g.

Code:
#!/bin/sh
echo -n "Enter password: "
stty -echo
read passwd
stty echo

The ${passwd} variable will then contain the password, but it will not print on screen.
 
DutchDaemon said:
Or you'll just have to leave dialog alone for the password entry, and use a bit of shell script. e.g.

Code:
#!/bin/sh
echo -n "Enter password: "
stty -echo
read passwd
stty echo

The ${passwd} variable will then contain the password, but it will not print on screen.

Thanks, that helped me a lot!
 
dialog in FreeBSD 9.0 is the same as devel/cdialog for previous versions. In cdialog sample directory (if I remember are in /usr/local/share/doc/cdialog or in the nearby, there are examples that use forms to ask in one dialog instance the user login name, the password and some other info. If samples are not where I said, download cdialog sources (formely dialog) and look inside samples directory.
 
Back
Top