Startup Scrpts

Paul Howarth paul at
Tue Feb 1 07:57:29 UTC 2005

On Mon, 2005-01-31 at 14:11 -0600, Jeff Vian wrote:
> On Mon, 2005-01-31 at 17:24 +0000, paul lawrence wrote:
> > From a promt, if I type the following the variables are set OK, but if
> > I include them in the file and type sh  they are
> > not set.
> >  
> > export set JAVA_HOME=/usr/java/j2sdk1.4.2_06
> > export set RESIN_HOME=/usr/local/resin
> > export set PATH=$PATH:/usr/java/j2sdk1.4.2_06/bin
> >  
> >  
> What shell are you running this script as?  I assume bash, but set is
> not a commonly used function AFAIK. (unset OTOH is commonly used.)

Whilst the syntax shown above is not commonly used, it is still
perfectly valid, at least in bash. I have to admit that it's so unusual
to see it written this way that I tried it myself to make sure it
actually worked!

> In bash these lines would be 
>    export JAVA_HOME=/usr/java/j2sdk1.4.2_06
>    export RESIN_HOME=/usr/local/resin
>    PATH=$PATH:/usr/java/j2sdk1.4.2_06/bin
> to set the environment variables.
> The path line works because $PATH is already an environment variable
> Your syntax is using 2 built in shell commands -- export & set -- and
> you cannot do that in most cases.

If you want maximum portability to other versions of Unix, you're better
off separating the setting of the variables and the exporting of them,
as some shells cannot combine the two:


Paul Howarth <paul at>

More information about the users mailing list