Setting environment variable on a remote solaris machine using shell script

Hi,

I am trying to set environment variable on a remote machine. I want to do it by running a shell script

Here's what I am doin

   rsh <remote-hostname> -l root "cd /opt/newclient; . ./setp.sh"

In setp.sh, I have

#############################
cd ../newlib;
export LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib:/usr/java/jre/lib/i386/client:`pwd`
cd ../newclient

#############################

Output I am getting is

sh: LD_LIBRARY_PATH=::/usr/lib:/usr/java/jre/lib/i386/client:/opt/newlib: is not an identifier

Script is fine when I ran on a remote machine.

. ./setp.sh

Can someone what's wrong with it?

Thanks,
Sundeep

Yes, I know exactly what's wrong. When you're logged in, you're not using the bourne shell. You're using either bash or ksh. When you run the rsh command, the bourne shell is being used.

Your code needs to look like this:

LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib:/usr/java/jre/lib/i386/client:`pwd`
export LD_LIBRARY_PATH

That will, by the way, work equally well in bash, sh, or ksh.