LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-21-2009, 01:24 PM   #1
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,561

Rep: Reputation: 57
stupid question with DIALOG


Hello

Code:
dialog  --clear --title "Question"  --inputbox  "How many pages you would like to retrieve starting from $REC?" 16 51   ;  ret=$?  ; clear ; echo $ret
whatever I enter in the inputbox, the pc displyas
Code:
0
what's wrong?
 
Old 11-22-2009, 03:05 AM   #2
gnashley
Amigo developer
 
Registered: Dec 2003
Location: Germany
Distribution: Slackware
Posts: 4,928

Rep: Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612Reputation: 612
You have to re-direct the output (2>temp-file)
Code:
#!/bin/sh

dialog  --clear --title "Question"  \
--inputbox  "How many pages you would like to retrieve starting from $REC?" 16 51 2>tmp.file

ret=$? 
RESULT=$(cat tmp.file)
rm -f tmp.file
case $ret in
  0)
    echo "Input string is '$RESULT'";;
  1)
    echo "Cancel pressed.";;
  255)
    echo "Box closed.";;
esac
There may be ways of getting around this using --stdout option or by filling a variable with the output[ RESULT=$(dialog commands) ], but using the temp file is usually suggested.
 
Old 11-22-2009, 03:27 AM   #3
frenchn00b
Senior Member
 
Registered: Jun 2007
Location: E.U., Mountains :-)
Distribution: Debian, Etch, the greatest
Posts: 2,561

Original Poster
Rep: Reputation: 57
Code:
ret=$?.
RESULT=$(cat tmp.file)
no really. This is kind of surprising that one has to use hte disk as default, for linux. Well as default, as you say one can find tricks.
But the one that coded this ... well pitty that we cannot change this, it si too late. once it is coded under linux, one cannot change the program otherwise no applications would work anymore. just e.g. debian insatller is based on dialog

I found this:
Quote:
# POSIX
foo=$(dialog --inputbox "text goes here" 8 40 2>&1 >/dev/tty)
echo "The user typed '$foo'"

and if I do this it is not working acutally.. pff not easy:


Quote:
dialog --title " qeustions" --yesno " Ready y/n" 10 30 2>tmp.file

RESULT=$(cat tmp.file)

echo $RESULT

Last edited by frenchn00b; 11-22-2009 at 03:38 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
recovering "lost" users..... probably stupid question (stupid user.......) bigjohn Linux - Newbie 6 11-07-2009 06:51 PM
dialog bash gauge wget question... DjRakso Linux - Newbie 1 12-19-2007 03:57 PM
Stupid, stupid question; I lost Klaptop. :( Surfrider Slackware 2 08-31-2005 09:12 PM
python gui file dialog question mulciber Programming 0 07-26-2005 07:37 AM
Stupid Dumb Stupid Question... drigz Linux - Software 3 09-23-2004 03:09 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 05:45 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration