Sounds like you are just missing the final newline when you paste. Paste 3 or more lines to verify that.

There is also a race as to how quickly the output will appear. Well, you wouldn't have this problem on, for example, Windows, as it echos input characters when they are read. Unix echos input characters when they are typed (which is a particularly bad choice when prompting for a password -- but it isn't like Unix is going to change this).

I see no easy way to work around this (unless switching to Windows happens to be easy in your case :). You could turn off echo but you probably want echo in some cases. You could turn off echo, put the tty in raw mode, and emulate echo. That is a lot of work compared to the code you have right now.

- tye        


In reply to Re: Copy multiple lines to a loop (echo race) by tye
in thread Copy multiple lines to a loop by eyekona

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.