Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re^3: Waiting For Input

by Corion (Pope)
on Mar 04, 2013 at 08:34 UTC ( #1021602=note: print w/replies, xml ) Need Help??

in reply to Re^2: Waiting For Input
in thread Waiting For Input

So, when does the loop end?

while( <STDIN> ) { ... }

Maybe you want to print out some diagnostics at the end of and in your main script, to learn when a program starts or finishes, and when a program waits for input.

Replies are listed 'Best First'.
Re^4: Waiting For Input
by Anonymous Monk on Mar 04, 2013 at 09:16 UTC

    The script gives me the last print statement conatined in it . So I know that the ends, But How do i tell this while loop to end? <\p>

      You may be correct, but the statement that you see the last print does NOT offer any assurances that actually ends: all you know for sure based on what you've told us is that runs thru the last print statement.

      Is "the last print statement contained in it" the very last code in the script?

      As to your question about how to end the while loop: you haven't shown us the code. Guessing on a fix for unknown code is not worth our time or yours.

      If you didn't program your executable by toggling in binary, it wasn't really programming!

      Why did you write that loop in the first place?

      On Windows, you end input to STDIN by entering CTRL+Z on an empty line and pressing enter.

        This is used such that when user presses ENTER the script stops and resume only when ENTER is pressed again

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1021602]
[Tanktalus]: Does anyone have a link to somewhere that explains why it's a bad idea to spit out text on stdout/stderr in the login scripts when it's a non-interactive shell?

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (3)
As of 2017-04-25 21:11 GMT
Find Nodes?
    Voting Booth?
    I'm a fool:

    Results (464 votes). Check out past polls.