Re: How to export variables on remote machine through ssh.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Try this:

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


William Estrada
MrUmunhum@xxxxxxxxxxx
Mt-Umunhum-Wireless.net ( http://Mt-Umunhum-Wireless.net )
Ymessenger: MrUmunhum



gajendrasharma1 wrote:
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

[Index of Archives]     [Open SSH Unix Development]     [Fedora Users]     [Fedora Desktop]     [Yosemite Backpacking]     [KDE Users]     [Gnome Users]

  Powered by Linux