In article <
4c752329-b208-4a7a...@googlegroups.com>,
James <
hsle...@yahoo.com> wrote:
>The remote login shell is csh. How do I get the desired output, which is
>1
>2
>3
>
>$ ssh remote 'bash -c "for f in 1 2 3; do echo $f; done"'
>f: Undefined variable.
>
>$ ssh remote 'bash -c "for f in 1 2 3; do echo \$f; done"'
>f: Undefined variable.
Nothing you do will fix that problem with the $ inside the "". csh won't
allow it. But it will let you end the "", add your $ protected by a
different kind of quoting, and resume with another "", like this:
ssh remote 'sh -c "for i in 1 2 3;do echo "\$"i;done"'
Or, if you switch around your outer quotes...
ssh remote "sh -c 'for i in 1 2 3;do echo \$i;done'"
(The backslash is eaten locally since the local shell is processing "". I'm
presuming the local shell isn't also a csh)
--
Alan Curry