Ethical Hacking Learn to find vulnerabilities before the bad guys do! Gain real world hands on hacking experience in our state of the art hacking lab. Course designed and taught by expert instructors with years of penetration testing experience. 12 student maximum in every class. Certification attempt included in every package. | Computer Forensics Training at InfoSec Institute Gain the in-demand skills of a certified computer examiner, learn to recover trace data left behind by fraud, theft, and cybercrime perpetrators. Discover the source of computer crime and abuse at your organization so that it never happens again. All of our class sizes are guaranteed to be 12 students or less to facilitate one-on-one interaction with one of our expert instructors. |

| Subject: | Re: How to export variables on remote machine through ssh. |
|---|---|
| Date: | Tue, 27 Nov 2007 16:29:44 -0500 |
On Tue, Nov 27, 2007 at 06:53:36AM -0800, gajendrasharma1 wrote:
a=10 ssh -l $user $host "export myVar=$a; cd $myDir; ./myScript.sh"
myDir isn't defined...?
this doesn't work, as probably the ssh shell might not understand the export command.
That depends on what shell $user has. If $user's shell is bash or ksh, the syntax you have here looks OK (assuming myDir is defined somewhere on the ssh CLIENT system, and you simply neglected to show us). If $user's shell is /bin/sh then "export foo=bar" is not necessarily going to work; it depends on which /bin/sh the system has. You're safer with "foo=bar; export foo". If $user's shell is csh or tcsh, then you need entirely different syntax. (And $user needs a swift kick, but that's a different story....) Something like "setenv myVar $a" should do. Note the lack of an "=" sign.
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: How to export variables on remote machine through ssh., Joseph Spenner |
|---|---|
| Next by Date: | Re: How to export variables on remote machine through ssh., Jan Pechanec |
| Previous by Thread: | Re: How to export variables on remote machine through ssh., Joseph Spenner |
| Next by Thread: | Re: How to export variables on remote machine through ssh., gajendrasharma1 |
| Indexes: | [Date] [Thread] [Top] [All Lists] |