Tugger the SLUGger!SLUG Mailing List Archives

Re: [chat] portable scripting


On Mon, 2003-01-27 at 22:29, Pete Ryland wrote:
> On Mon, Jan 27, 2003 at 09:32:10PM +1100, Ken Foskey wrote:
> > I want to write a portable script that must pass environment variables
> > to a configure script.  If I use #!/bin/sh will "export CC=/path/to/CC"
> > always work?  This does not work with tcsh and there is a slight
> > possibility that this is the only shell installed and symlinked to sh.
> 
> configure scripts can be passed CC via the command line:
> 
> ./configure CC=/path/to/cc

this is :

CC=/path/to/cc ./configure

this is equivalent to:

CC=/path/to/cc
export CC
./configure
unset CC

Ie the CC variable is exported in the shell that configure runs in but
not yours, handy trick once you understand it, totally confusing to a
DOS programmer :-)

This does NOT work with csh shell derivatives.

> -- 
> Thanks
> KenF
> OpenOffice.org developer