Re: Startup Scrpts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 resin-a.sh file and type sh resin-a.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:

JAVA_HOME=/usr/java/j2sdk1.4.2_06
RESIN_HOME=/usr/local/resin
PATH=$PATH:/usr/java/j2sdk1.4.2_06/bin
export JAVA_HOME RESIN_HOME

Paul.
-- 
Paul Howarth <paul@xxxxxxxxxxxx>


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux