LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Zenity If else statement question? (https://www.linuxquestions.org/questions/linux-general-1/zenity-if-else-statement-question-750936/)

linux_newb 08-28-2009 02:09 PM

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

pixellany 08-28-2009 02:56 PM

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.

linux_newb 08-28-2009 03:39 PM

Case Construct
 
Quote:

Originally Posted by pixellany (Post 3661247)
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 =(

pixellany 08-29-2009 01:49 AM

Quote:

Originally Posted by linux_newb (Post 3661275)
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

linux_newb 09-01-2009 08:28 AM

This did the trick!
 
Quote:

Originally Posted by pixellany (Post 3661645)
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!! :cool:


All times are GMT -5. The time now is 07:56 PM.