in reply to Copy multiple lines to a loop

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        

  • Comment on Re: Copy multiple lines to a loop (echo race)

Replies are listed 'Best First'.
Re^2: Copy multiple lines to a loop (echo race)
by eyekona (Acolyte) on May 21, 2014 at 07:56 UTC
    I will not change to windows but I will ask some of the windows users if it is actually working for them.
      but I will ask some of the windows users if it is actually working for them

      That would require "the windows users" to be running the script on Windows. But elsewhere you said:

      But as several other people use this script some are also connecting to this linux server from windows and mac clients

      That won't make a difference as the ssh client will be reading what they paste asynchronously and thus (on Windows) causing it to be echoed before the script has read that same data.

      - tye