Loop in remote shell command

Hi All

Does anyone have any idea on how I can create a loop when running a remote shell. e.g.
If I want to execute the following command remotely and log the output locally
for x in `lsvg`
do
lsvg $x
done > /tmp/myfile

I have tried
rsh myhost -l root for x in `lsvg`^Jdo^Jlsvg $x^Jdone
however get the error
ksh: 0403-057 Syntax error at line 1 : `for' is not matched.

Any ideas.

Thx

J

Try this :

rsh myhost -l root 'lsvg|xargs lsvg'

Jean-Pierre.