LinuxQuestions.org
Visit Jeremy's Blog.
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 08-01-2007, 08:17 AM   #1
efus
Member
 
Registered: Jun 2003
Location: Odense, Denmark
Distribution: Fedora
Posts: 32

Rep: Reputation: 15
Angry a little problem with Xdialog


I am trying to make a small bash script and using Xdialog.

Code:
#!/bin/sh

Xdialog --no-tags \
	--title "RADIOLIST BOX" \
        --radiolist "blahblahblah ?" 20 50 3 \
        "first"  "something 3" ON \
        "second"    "something2" off \
        "third"  "something3" off  2>/tmp/checklist.tmp.$$

retval=$?
choice=`cat /tmp/checklist.tmp.$$`
rm -f /tmp/checklist.tmp.$$

case $retval in
  0)
      echo "$choice";;
  1)
    echo "Cancel pressed.";;
  255)
    echo "Box closed.";;
esac
I am having problems with $choice, I can echo it and get the right output, but I can't
compare it to any value or other variable.

All I want to do is this
Code:
if [ "$choice" -eq "first" ] 
then
   <do something>
elif [ "$choice" -eq "second" ] 
then
   <do something else>
else
   <do some third thing>
fi
but it will not work, I don't get why?
 
Old 08-01-2007, 09:38 AM   #2
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
Hi.

'-eq' is for numerical comparison. Try '==' instead.

Dave
 
Old 08-01-2007, 10:10 AM   #3
efus
Member
 
Registered: Jun 2003
Location: Odense, Denmark
Distribution: Fedora
Posts: 32

Original Poster
Rep: Reputation: 15
still does not work
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Xdialog checklist help serris Programming 2 10-31-2006 02:57 AM
Winetools and Xdialog kerryhall Linux - Software 2 04-28-2006 02:38 PM
Need help with Xdialog justintime32 Linux - Software 1 06-17-2005 02:17 PM
Using Xdialog to su death_au Linux - Newbie 1 05-31-2005 10:41 PM
Xdialog --geometry bendeco13 Linux - General 0 11-06-2004 12:20 AM

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

All times are GMT -5. The time now is 01:58 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