fetch Variable value

Hi Guys,

I have written a script that declares all the variables and its values in a conf file.
Now i use a variable whose value i need to change it in one of the sub-file that is used in the script.

In the startup file i want to print or check its value.
The value get changed and printed properly in the sub-file but in the startup file at the end it displays the value in the conf file which has all the variables declared.

how can i fetch the last updated value of that variable.

Swapna

Best post your script so we see what you do. Also use [ code ] and [ /code ] tags please.

------------------------
contents in conf file utilityenv.conf
------------------------

export DataLoadedSummaryFile=Load_Measure_Summary.tab
export TOTALETLFILES=7
export ETLFILESFOUND=0

-------------------------------------
Startup File contents ETL_Monthly.sh
-------------------------------------
. ~/.bashrc
SetTkEnv 2>/dev/null

#This File contains all the variables used in the ETL Process
. ./utilityenv.conf
#Process 5
#This File Loads the Actual Measure Data in the Staging Database User From the Source Files received
bash $CommandFiles/Load_Measure_Data_In_Staging.sh
Status=$?

mailsubject="ETL Process - Success"
echo "" > $ETL_HOME_DIR/mailbody.txt
echo "ETL Files found : " $ETLFILESFOUND
echo "Total ETL Files : " $TOTALETLFILES
if [ $ETLFILESFOUND -eq $TOTALETLFILES ]
then
echo "ETL process completed successfully." >> $ETL_HOME_DIR/mailbody.txt
else
echo "ETL process partially completed." >> $ETL_HOME_DIR/mailbody.txt
fi
echo "<BR><BR>" >> $ETL_HOME_DIR/mailbody.txt

-------------------------------------------------------
sub-file Load_Measure_Data_In_Staging.sh contents
-------------------------------------------------------
bash utilityenv.conf
if [ $filecount -gt 1 ] #Check for more than one dat files exist for a single control file
then
echo "set source_file_count = -1 " >> $SqlFiles/update_configuration_master.sql
elif test -f $datfile #Check file exist
then
ETLFILESFOUND=`expr $ETLFILESFOUND + 1`
echo "ETL files found : " $ETLFILESFOUND
loadtype=`echo $datfile | tr "_" "\n" | tail -1 | cut -d"." -f1`

	filedatacount=\`cat $datfile | wc -l\`
	\#filedatacount=\`cat $datfile | cut -sd "," -f13 | sed -e '/^$/ d' | wc -l\`

fi

You should use "source" (dot) instead of "bash" if you want ETLFILESFOUND and TOTALETLFILES to be visible in the calling script.

but will i be able to change its value in the sub-file Load_Measure_Data_In_Staging.sh
and retrieve the same

If I understand your question correctly, then yes (and you should be able to trivially try it and see what happens).