LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 08-28-2009, 02:09 PM   #1
linux_newb
Member
 
Registered: Aug 2009
Distribution: Windows 7, RHEL 5.4, CENTOS 5.4, RHEL 6
Posts: 55

Rep: Reputation: 15
Question Zenity If else statement question?


Hi guys,

I'm currently using zenity to write a proram that will display a radiolist, and then based off of your answer to the radio list display a set of question for the box that appears after it. For example it will first ask you who want to learn about either DOGS or CATS, if you say cats it will show you all types of cats like tabby, persian etc. However if you say dogs it will show you a different zenity radiolist which shows german spheards, golden receiver, etc. Is there anything like a if then statement I can use withen xenity to accomplish this task?

I would really appreciate anyones help, below is what I have so far:



ans=$(zenity --list --title "Selection Utility" --text "Choose Animal" --radiolist --column "Select" --column "Available Options" true "CATS" false "DOGS"); echo "Platform = $ans" >> USE.txt

ans1=$(zenity --list --title "Selection Utility" --text "Choose type" --radiolist --column "Select" --column "Available Options" true "golden retriever" false "persian" false "tabby" false "Shepard" false "Doberman"); echo "cattype = $ans1" >> USE.txt
 
Old 08-28-2009, 02:56 PM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Welcome to LQ!!

I don't think you are going to run an "if" construct inside of Zenity. My hunch is that you want a "case" construct which takes the output of one Zenity call and uses it to determine the structure of the next call.

If you don't already have it, go to http://tldp.org and get the Bash Guide for Beginners and Maybe also the Advanced Bash Scripitng Guide.
 
Old 08-28-2009, 03:39 PM   #3
linux_newb
Member
 
Registered: Aug 2009
Distribution: Windows 7, RHEL 5.4, CENTOS 5.4, RHEL 6
Posts: 55

Original Poster
Rep: Reputation: 15
Case Construct

Quote:
Originally Posted by pixellany View Post
Welcome to LQ!!

I don't think you are going to run an "if" construct inside of Zenity. My hunch is that you want a "case" construct which takes the output of one Zenity call and uses it to determine the structure of the next call.

If you don't already have it, go to http://tldp.org and get the Bash Guide for Beginners and Maybe also the Advanced Bash Scripitng Guide.
Hi, Thank you for your reply, I can't seem to find anything on case constructs =(
 
Old 08-29-2009, 01:49 AM   #4
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by linux_newb View Post
Hi, Thank you for your reply, I can't seem to find anything on case constructs =(
Where did you look??

Here it is in the Bash Guide for Beginners:

http://tldp.org/LDP/Bash-Beginners-G...ect_07_03.html
 
Old 09-01-2009, 08:28 AM   #5
linux_newb
Member
 
Registered: Aug 2009
Distribution: Windows 7, RHEL 5.4, CENTOS 5.4, RHEL 6
Posts: 55

Original Poster
Rep: Reputation: 15
This did the trick!

Quote:
Originally Posted by pixellany View Post
Where did you look??

Here it is in the Bash Guide for Beginners:

http://tldp.org/LDP/Bash-Beginners-G...ect_07_03.html
The case statement worked!!! TY VERY MUCH!!
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Not so much a question but more of a statement dstrbd1 Fedora 4 01-06-2006 10:13 PM
DEBUG statement question djgerbavore Programming 3 01-26-2005 09:37 AM
for statement c code question dragoon linux Programming 3 12-31-2003 11:17 AM
bash if statement question xscousr Programming 3 09-02-2003 11:58 AM
question about C 'for' statement ... purpleburple Programming 8 08-25-2002 07:12 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:26 PM.

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