How to export variables on remote machine through ssh.




Hello experts,

I need ur help on solving this problem.
I am writing a automation tool that runs several shell scripts on different
remote hosts using ssh. These scripts need various pre-defined variables to
run. I want to provide these variables to the script by exporting these
variables after doing ssh and then run the script that use it, like this:

a=10
ssh -l $user $host "export myVar=$a; cd $myDir; ./myScript.sh"

this doesn't work, as probably the ssh shell might not understand the export
command.

Can anybody please tell me how shall i solve this problem.

Thanks.
Gajendra
--
View this message in context: http://www.nabble.com/How-to-export-variables-on-remote-machine-through-ssh.-tf4882213.html#a13972248
Sent from the SSH (Secure Shell) mailing list archive at Nabble.com.



Relevant Pages

  • Re: How to export variables on remote machine through ssh.
    ... I am writing a automation tool that runs several shell scripts on different ... remote hosts using ssh. ...
    (SSH)
  • Re: [Long] about ksh93 (Was: Bourne Shell Programming on Windows)
    ... Are you saying that David Korn is an unitiated or ignorant ksh ... > You provided one obscure example that does not occur in scripts. ... > in every shell. ... that should be teached in every shell programming book. ...
    (comp.unix.shell)
  • Re: Add user in Unix from command Line
    ... what shell the script should be interpreted with. ... Do you have any concept how many linux scripts that are part of the ... of relying on bash extensions are negligible. ... Those scripts at least in the sco case were probably a conscious design ...
    (comp.unix.sco.misc)
  • Re: [Long] about ksh93 (Was: Bourne Shell Programming on Windows)
    ... Note that in src/cmd/ksh93/OBSOLETE in ksh93 source ... > But this is a shell feature, not a shell programming feature. ... Look at David Korn's himself ksh scripts on its home ...
    (comp.unix.shell)
  • Re: Learning Lisp
    ... I compared VNC to SSH. ... Some programs can work only over VNC or a similar protocol, so I had a chance to compare these approaches. ... Let's say I need to check access rights on file /home/foo/bar.txt on server quux. ... This is what I would call 'doing it myself' -- I think of something, translate it to shell language, type and get results. ...
    (comp.lang.lisp)