Operating System - HP-UX
1846905 Members
3653 Online
110256 Solutions
New Discussion

Re: How to set dynamically a variable

 
SOLVED
Go to solution
Leo The Cat
Regular Advisor

How to set dynamically a variable

Hi

Huh, here a small affair.

I've the command:
grep -i OHOME= $(find /su01 -name attachHome.sh | grep -v Templates)

This return a result like this:
OHOME=/su01/app/oracle/product/10.1.2

How to execute the result. In fact I'd like to set OHOME with /su01/app/oracle/product/10.1.2

If i do something like that:
$(grep -i OHOME= $(find /su01 -name attachHome.sh | grep -v Templates))
I've the error
ksh: OHOME=/su01/app/oracle/product/10.1.2: not found.

How to to this ?

Bests Regards
Den
2 REPLIES 2
OldSchool
Honored Contributor
Solution

Re: How to set dynamically a variable

from what I can see here, something like:

a=$(grep -i OHOME= $(find /su01 -name attachHome.sh | grep -v Templates))
eval $a
$OHOME

might be close

Leo The Cat
Regular Advisor

Re: How to set dynamically a variable

Oldschool's respons is efficient !

Thanks a lot.
Bests Regards