I have the below config file : OO_CONF.conf with the below contents:
appPackage_name = sqlncli
appPackage_version = 11.3.6538.0
Now i want to read these variables inside my shell script. So i want a variable $appPackage_name and it should contain the value: sqlncli
The way i am trying to do this is :
while read line; do
newline=`echo $line | sed -e 's/ //g'`
expr "$newline"
done < ./OO_CONF.conf
echo "$appPackage_name"
But it does not seem to work.
Request some help on this please.
Use the
declare
built-in inbash
with-g
flag to make it globally available,The idea is to set the
IFS
to=
so to split the lines in the file to read the key and value pairs and then withdeclare
we can create variables on the fly with the below syntax