remsh newhost "for loop"

Hi,

In ksh how can I execute something like this:

remsh newhost "for i in 1 2 3 4 5 do echo file$i; cat file$i; done"

I cannot pass the contrl J or enter in th above line which is required by the for loop.

Thanks...

remsh newhost "for i in 1 2 3 4 5 ; do echo file$i; cat file$i; done"

The ^J character is not required for the 'for' loop. Note the semicolon I have inserted between the '5' and the 'do' part of your statement.

You could insert the ^J character, though. First, do a "set -o vi", to use 'vi' style command editing. ( I recommend some familiarity with 'vi' before you do this. ) Then, in your command, press <ctrl>+v , <ctrl> + j . That should insert the newline character.