in reply to Re^5: Advice on running perl program over ssh
in thread Advice on running perl program over ssh

(Not OP here.) Variable setting not worky (ssh: OpenSSH_5.3p1; sh: bash variant on CentOS) ...

cat c ; echo ; ssh user@host 'Q=xir sh' < c echo $Q Q=xir: Command not found.

... and do not see it working sans extra work (compared to setting the variable in the script itself).

salva, if your proposed code worked for you, I would be interested in knowing about your setup to satisfy personal curiosity.

Replies are listed 'Best First'.
Re^7: Advice on running perl program over ssh
by salva (Canon) on Jul 16, 2014 at 06:13 UTC
    It works for me:
    $ echo 'echo $FOO' | ssh localhost 'FOO=bar sh' bar

    Probably you have a non POSIX compatible shell like tcsh configured as your login shell.