views:

185

answers:

2

Hi all,

I am facing a curious issue. I have bash script I am running from powershell in windows that does a for loop. Every once in a while, one of the loop iteration hangs until I hit enter on the keyboard. This doesn't happen all the time, in fact, it happens pretty rarely. But it still does. The interesting thing is that my loop innards is basically "time command" and so after I hit enter, it'll tell me how long the command took to run. The command actually takes way less time to execute than the loop iteration takes - because it's waiting for keyboard input for some odd reason.

It's pretty annoying to leave a script running overnight and come back in the morning to see that it didn't get very far.

Anyway, if someone knows WHY this happens and WHAT to do to get around it, I'd really like to know.

Thanks, jbu

A: 

Until you post the script, there's little we can do to help.

However, in general, one of your commands probably returns a null once in a while as input to stdin of another command which, upon seeing null looks to the terminal as stdin. Or something along those lines.

Dennis Williamson
A: 

I agree with JBU...I have seen this happen with my powershell scripts too ! Sometimes for no reason it gets stuck (even though the script requires no input) and once I hit enter, it continues execution (sometimes very quickly). Not sure why though !

prashanth