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.