Re: calling a script from within another script

From: Adam Dyga (adeonNOSPAM_at_tlen.pl)
Date: 09/30/03


Date: Tue, 30 Sep 2003 16:43:01 +0200

jeffm wrote:

> Hi
> I've got a script that sets environment variables , called env.sh and a
> second one , called main.sh , which uses the environment variables set
> by env.sh
>
> Now , main.sh has these two lines (amongst other stuff)
>
> $SCRIPTS_LOCATION/remove_all_logs.sh
> $SCRIPTS_LOCATION/remove_all_tran_logs.sh
>
> Variable SCRIPTS_LOCATION (together with other variables)is set in
> env.sh as follows
>
> export SCRIPTS_LOCATION=/root/scripts
> export APP_INSTALL_LOGS=/websphere/logfiles/work
> export WSCPDIR=/opt/WebSphere/bin
> export WS_TRAN_LOGS=/opt/Websphere/tranlog
>
> How do I call env.sh from within main.sh , to set the environment
> variables that are later used (in main.sh) ?
> Both main.sh and env.sh reside in the same directory
>

First of all, do not export variables in env.sh, just include following line
in the beginning of main.sh:

. /path/env.sh

(notice the dot at the beginning).
This will make your variables from env.sh visible in main.sh

-- 
Greets
adeon