## Help with infinite loop problem

Help with infinite loop problem
# 1
08-19-2011
Help with infinite loop problem

1. The problem statement, all variables and given/known data:
My problem is an infinite loop when i press any other key other then Y or y in the while loop. what i want it to do is return to the normal script outside of it if pressing N or n or keep asking the same question if its any other button. Perhaps my knowledge and understanding of loops is inaccurate. But i have made it very similar to the lecture shown ones and it isnt working out very well. Thanks in advance.

2. Relevant commands, code, scripts, algorithms:

P.S. I am using cygwin in windows to do this script.

3. The attempts at a solution (include all code and scripts):
4. Insearch: (University of Technology Sydney), Sydney NSW, Australia, James Hu (web systems), www(dot)insearch.edu.au/default.aspx?ArticleID=430

Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).
 Ren_kun View Public Profile for Ren_kun Find all posts by Ren_kun
# 2
08-19-2011
There's no point checking the same thing 3 times, check it once, and do what you need to do there, once.
This User Gave Thanks to Corona688 For This Post:
 Corona688 View Public Profile for Corona688 Visit Corona688's homepage! Find all posts by Corona688
# 3
08-19-2011
Thanks for the prompt reply. But could you tell me what you mean by saying i was testing the same thing 3 times ><? Just wanna learn more.
 Ren_kun View Public Profile for Ren_kun Find all posts by Ren_kun
# 4
08-19-2011
Quote:
Originally Posted by Ren_kun
Thanks for the prompt reply. But could you tell me what you mean by saying i was testing the same thing 3 times ><? Just wanna learn more.
Means exactly what it says. You're checking the value of \$answer in 3 places, once is enough.

 Corona688 View Public Profile for Corona688 Visit Corona688's homepage! Find all posts by Corona688
# 5
11-03-2011
while loop given infinite

ok let i telling you that's problem occurred when we put the value of i++ for the set time and when i++time divided by 0 then given exp-ration always infinite and while loop always depend on two way condition true or wrong and similar with if else statement way same but condition not similar in both statement for more help if you want related to solve expression
 jhoncorner View Public Profile for jhoncorner Find all posts by jhoncorner

## Infinite loop query

I have a script script.shwhich is scheduled to run at 11 AM everyday. # script.sh Code: ./scb_script.sh & unfortunately scb_script.sh is running today in infinite loop as respective files are not available. My question, when script.sh starts running tomorrow, will the old process be...

## How to stop infinite loop

Im unable to stop the below infinite loop (bash script). Can someone tell me why this isnt responding to signals eg: ctrl+c (SIGINT) or ctrl+z c=0 test_loop() { c=\$((\$c+1)) echo "count value is : \$c " sleep 1 test_loop } Im using: SunOS 5.10 PS: If run this as...

## My for loop decides to become an infinite loop?

Hi, I was debating if I should put this in the dummies or scripts section, I apologize in advance if I chose poorly. Fairly new to Unix and BASH scripting but I thought I made it fairly well given my limited understanding. However, the output indicates that it's looping and I'm ending up with a...

## Call a infinite loop

Hi All, I need to run an infinite loop. requirement below: function1 --> creates a file file1 function2 ---> need to call if the file creates i am running these both function via a script --> script.sh i need to run the function1 first and if the file file1 creates then need to run the...

## Procmail and infinite loop

I wanted to copy (not forward but copy) all incoming email to another address of mine. It worked, but now I encountered an infinite loop problem: When the second address doesn't like the content and bounces the message back, the bounce message will be sent back and forth. So, what I have in...

## Infinite while loop

what is the difference between while:,while true and while false?

## infinite while do loop problem

hi all, this is how my scrip looks like #!/bin/sh bindir='/opt/apps/script/bin' datadir='/opt/apps/script/data' dir='/opt/apps/script' while : ; do ls -1rt /opt/apps/script/data/check.txt*|tail -1 > /dev/null 2>&1 if ;then chmod +rwx \$bindir/dummy2.sh ...

## Is my code in an Infinite Loop?

Production C code compiled without the dash-g option is running, and seems to be in an infinite loop. Is there a way to tell? Is there a diagnostic tool that will report what objects or what lines of code or even what functions are being executed? Or is my best option to kill it with a dump? ...

## Infinite loop not looping

Hi guys, I'm having a problem getting my infinite loop to loop. It simply reads in the users choice form the menu, executes the corresponding case statement and quits instead of looping back to the main menu again. I have a feeling it might be something with my if then statements within the case...

## ls command in infinite Loop

Hi, whenever I am giving a 'ls' command system is going into infinite loop displaying the current home directory. There is no separate shell script/file with ls name anywhere in the system. I am using Solaris 10. Any help / guidance in solving this problem is highly appreciated. ...