Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re: Copy multiple lines to a loop

by hippo (Abbot)
on May 20, 2014 at 17:00 UTC ( #1086824=note: print w/replies, xml ) Need Help??

in reply to Copy multiple lines to a loop

Standard input from your terminal is line-buffered so your loop will process each line as it arrives.

To see the output you have shown you could either disable the line-buffering of STDIN (I've never done that and with pretty good reasons) or disable line-buffering of STDOUT (less problematic) or else save your output in the loop to a variable rather than printing directly and then print the entire variable on loop exit.

In any of these cases you will need to send the EOT character to notify the script of the end of input. This is typically ^D

Replies are listed 'Best First'.
Re^2: Copy multiple lines to a loop
by eyekona (Acolyte) on May 21, 2014 at 08:02 UTC
    Use a variable... Yes sometimes I'm an idiot. Stuff like this happens when admins try to be programmers...

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1086824]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (3)
As of 2018-05-20 12:24 GMT
Find Nodes?
    Voting Booth?