[vox-tech] Inheriting env variables when you do a su

Micah J. Cowan vox-tech@lists.lugod.org
Wed, 23 Apr 2003 14:03:01 -0700


On Wed, Apr 23, 2003 at 12:15:38PM -0700, Richard Crawford wrote:
> Tim Riley wrote,
> 
> > Sure: export SPIFFY_VAR. Then the -c option is not needed.
> 
> So, for example, in my script I'd write,
> 
> SPIFFY_VAR=/home/stuff
> export SPIFFY_VAR
> .
> .
> .
> su process_user "{$SPIFFY_VAR}/do/something/cool.exe"

You could use the above line without the export. {$SPIFFY_VAR} will be
interpreted by the shell script before it is sent to su.

-Micah