Operating System - HP-UX
1827064 Members
4496 Online
109713 Solutions
New Discussion

Re: How to replace a text like ${ORACLE_HOME} in a string by the real value of the variable itself ?

 
SwissKnife
Frequent Advisor

How to replace a text like ${ORACLE_HOME} in a string by the real value of the variable itself ?

Hi,

 

How to replace a text like ${ORACLE_HOME} by the real value of the variable itself ?

Here is an example:

PRM_PARMS=BLKSIZE='1048576,SBT_LIBRARY=${ORACLE_HOME}/lib/libddobk.so,ENV=(STORAGE_UNIT=oramount,BACKUP_HOST=server1,ORACLE_HOME=${ORACLE_HOME})'

ORACLE_HOME=/u01/test

I tried something like this:

 

echo $PRM_PARMS | sed 's/'/${ORACLE_HOME}'/${ORACLE_HOME}/g'

 

But without success.

 

Do you have any idea of the sed command I should write ?

 

Thanks a lot in advance,

Kind regards,

Den.

2 REPLIES 2
Bill Hassell
Honored Contributor

Re: How to replace a text like ${ORACLE_HOME} in a string by the real value of the variable itself ?

Not sure what you need, but simply tracing the script will show the value for each variable.
Insert the command: set -x into the script
or run the script with -x as in:   ksh -x myscript

 



Bill Hassell, sysadmin
SwissKnife
Frequent Advisor

Re: How to replace a text like ${ORACLE_HOME} in a string by the real value of the variable itself ?

I finally found a solution .../

 

PRM_PARMS=$(echo $PRM_PARMS | sed "s|\${ORACLE_HOME}|${ORACLE_HOME}|g")

 

 

thanks.