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



--- gajendrasharma1 <gajendra.sharma@xxxxxxx> wrote:


Hello experts,

I need ur help on solving this problem.
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"


Can you modify your script to take arguments on the
command line? You could then pass your variables on
the command line. ie:

ssh -l $user $host $myDir/myScript.sh myVar

Then your script needs to contain something like

$myVar = $1




____________________________________________________________________________________
Be a better pen pal.
Text or chat with friends inside Yahoo! Mail. See how. http://overview.mail.yahoo.com/



Relevant Pages

  • Scripts using SSH and SSH_ASKPASS
    ... To test SSH scripts you better destroy the control TTY. ... The trick is to run YOUR script on YOUR local ... As for the password relaying command: this needs not be an X command. ... # we read one line from a temporary pipe. ...
    (comp.security.ssh)
  • Re: remote server backup script
    ... > Just type away at the command line. ... Make a backup of whatever you want ... > command line, in a script. ... >>the server ssh key on the clients machine). ...
    (comp.os.linux.misc)
  • Re: [PHP] SSH and php
    ... % % Is it possible to run a SSH command from php? ... it's possible to run any command from php. ... There are ways to do that -- I personally would create a kick script ...
    (php.general)
  • Using SSH to terminate remote systems for disaster recovery
    ... I have a need to terminate a number of AIX 5.1 systems ... from a single script. ... I can do this using ssh. ... if I issue the shutdown command from ssh, ...
    (AIX-L)
  • RE: Execute script on remote computer
    ... Execute script on remote computer ... you should just use the ssh command coupled with the name of the ...
    (comp.lang.python)