[bash] Zenity loop (raspbian)


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting [bash] Zenity loop (raspbian)
# 8  
Old 10-04-2016
Okay guys thanks for your help but i'm completly lost.

Rudic i tryed this....
Code:
#!/bin/bash

while true
  do   choice="$(zenity --width=200 --height=150 --list --column "" --title="test" 
 
        case $choice in
                "go to menu")   ... ;;
                "test")         ... ;;
                "exit")         ... ;;
                *)              error handling ;;
        esac
  done

rbatte1 i tryed your code i am able to get the main menu but when i want the sub menu gets complicated . i don't get with the if how to select the variable and apply it

how can i say if [select "go to menu" do .... ]
the code:

Code:
#!/bin/bash
keep_looping=1
while [ $keep_looping -eq 1 ]
do choice="$(zenity --width=200 --height=150 --list --column "" --title="test" \
  "Go to next menu" \
 "test"
  "Exit ")"
   
   if [  "${choice}" in     
    "Go to next menu" )
      while true; do
        choice2="$(zenity --width=200 --height=150 --list --column "" --title="test" \
        "Do Something" \
        "Do Something Else " \
        "Back")" 
  
        
      done  ]
   then
      echo "Leaving loop"
      keep_looping=0
   fi
done

# 9  
Old 10-04-2016
Did you REALLY try that pseudo code verbatim?
# 10  
Old 10-04-2016
well i though i could manage to do some with it.
# 11  
Old 10-04-2016
And what did you do with it?
# 12  
Old 10-04-2016
absolutly nothing !

---------- Post updated at 10:54 AM ---------- Previous update was at 10:40 AM ----------

i agree i am from understanding well bash i just need example related to my code to get it...
# 13  
Old 10-04-2016
Maybe there's a misunderstanding here.

When someone posts a problem in these fora, quite a lot of volunteers read it and might want to jump in to help, sometimes giving hints, sometimes pointing out errors, sometimes, if you're lucky, providing an entire working program, eventually even including error handling. The latter shouldn't be expected. And, it can happen only if the situation is absolutely clear, i.e. the requirements are clearly stated, own attempts and representative input data are posted, a desired output is shown, and possible error messages are depicted.

This is not the case with your posts. Unless you give us way more details, I see the help we can give is very general hints only. Like the structural approach models given. You would need to apply some creativity to adapt those to your own problem. If you get stuck, post your attempt and where you're stuck, and we're happy to help out further.
# 14  
Old 10-04-2016
there is no misunderstanding no need to post that much i know how it works.

i post my code wich is working but have a loop issue then you gave me some advice wich i try to apply at best .
then
your colleague gave another way to do it wich i tryed also but has it's not my code anymore i don't know how to use it that's why i ask an "example" related to my code.

I didn't ask to write the code for me but just an example to help me understand

And this kind of answer "Did you REALLY try that pseudo code verbatim?" does not provide help even if it look stupid to you
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash Menu using zenity

Hi, I'm new to bash, and have an example menu script using Zenity. It works fine if the user enters A B or C, but if the user enters nothing, I can only figure out how to exit the script. How do I get the menu to reappear if no input is selected? The script is: title="Select example"... (2 Replies)
Discussion started by: allen11
2 Replies

2. Shell Programming and Scripting

Help on for loop in bash

Hi, In the code "for loop" has been used to search for files (command line arguments) in directories and then produce the result to the standard output. However, I want when no files are named on the command line, it should read a list of files from standard input and it should use the command... (7 Replies)
Discussion started by: Ra26k
7 Replies

3. Shell Programming and Scripting

PWM script for raspbian

Hello Community, I'm a little new to shell scripting and i was trying to write a servo control script for my Raspberry PI, using raspbian. here is the code. #!/bin/sh #Signal time signal_time_gpio27=0.0015s #Delay time signal_delay_gpio27=0.02s if grep -lq 0... (1 Reply)
Discussion started by: drux
1 Replies

4. Shell Programming and Scripting

Bash for loop with two variables

Hi, I have the following folder structure: TST500-1000 TST500-2000 TST500-3000 TST700-1000 TST700-2000 TST700-3000 TST900-1000 TST900-2000 TST900-3000 I would like to store the numbers in the first column (considering "-" as column separator) into a variable then the numbers in... (3 Replies)
Discussion started by: alex2005
3 Replies

5. Shell Programming and Scripting

Bash For Loop Help

This is a short program I wrote to search through a directory and move files containing the keyword to a folder. #!/bin/bash echo 'What is the directory?' read DIR echo -e '\n' echo 'What is the keyword?' read KEY echo -e '\n' cd $DIR rmdir 'relevant_files' mkdir 'relevant_files'... (5 Replies)
Discussion started by: zenyoul
5 Replies

6. Shell Programming and Scripting

If loop in bash

Hello, I have a script that runs a series of commands. Halfway through the script, I want it to check whether everything is going alright: if it is, to proceed with the script, if it isn't to repeat the last step until it gets it right. My code so far looks like this, simplified a bit: ... (3 Replies)
Discussion started by: Leo_Boon
3 Replies

7. Shell Programming and Scripting

BASH loop inside a loop question

Hi all Sorry for the basic question, but i am writing a shell script to get around a slightly flaky binary that ships with one of our servers. This particular utility randomly generates the correct information and could work first time or may work on the 12th or 100th attempt etc !.... (4 Replies)
Discussion started by: rethink
4 Replies

8. Shell Programming and Scripting

Bash: Help with output from a for loop

Hi, Sorry I'm new to shell scripting.. my loop is as follows: let i=0 for item in ${APPSARRAY} do #..some code to get a unique value called $result let i=i+1 done What I want to do is within the for loop, create a comma seperated list: ... (3 Replies)
Discussion started by: mjwoodford
3 Replies

9. Shell Programming and Scripting

Using variables created sequentially in a loop while still inside of the loop [bash]

I'm trying to understand if it's possible to create a set of variables that are numbered based on another variable (using eval) in a loop, and then call on it before the loop ends. As an example I've written a script called question (The fist command is to show what is the contents of the... (2 Replies)
Discussion started by: DeCoTwc
2 Replies

10. Shell Programming and Scripting

bash and ksh: variable lost in loop in bash?

Hi, I use AIX (ksh) and Linux (bash) servers. I'm trying to do scripts to will run in both ksh and bash, and most of the time it works. But this time I don't get it in bash (I'm more familar in ksh). The goal of my script if to read a "config file" (like "ini" file), and make various report.... (2 Replies)
Discussion started by: estienne
2 Replies
Login or Register to Ask a Question