I am writing a shell program that executes a lot of Oracle SQL Files on different databases based on the enviroment setting value. I am trying to design a parameter file where i can store the environment values for all the databases in the below format
Environment File
File Name oraenv
# /* DB1 /
ORACLE_SID=DB1
ORACLE_BASE=
ORACLE_HOME=
PATH=
LD_LIBRARY_PATH=
.
.
Other Parameters
# / End /
# / DB2 /
ORACLE_SID=DB2
ORACLE_BASE=
ORACLE_HOME=
PATH=
LD_LIBRARY_PATH=
.
.
Other Parameters
# / End /
# / DB3 /
ORACLE_SID=DB3
ORACLE_BASE=
ORACLE_HOME=
PATH=
LD_LIBRARY_PATH=
.
.
Other Parameters
# / End */
Master Script <-- Main Program that uses these parameters
File Name actions.sh
When the script is executed as ./actions,sh DB1 i want this to read all the parameters related to DB1 from the oraenv written between the pattern below
# /* DB1 /
.
...
..
# / End */
One issue that i am facing with the above code is if i have the following line in my parameter file like
Parameter File content
infile
# /* DB1 /
ORACLE_HOME=/temp
OH=$ORACLE_HOME
# / End */
The below command
for LINE in `sed -n '/ '${DB}' /,/ End /p' infile| grep -v ^#`; do
export "${LINE}"
done
works great when it reads line one that is ORACLE_HOME is set to /temp
but i expect it to set OH=/temp also but OH gets set to $ORACLE_HOME.Basically it does not translate the $sign read from the parameter file. Any ideas please