0

I have "INSTALLMODE=BASIC" key value pair defined in my config file. And, I am splitting these key value pairs and assigning them as below.

INSTALLMODE=BASIC
key=INSTALLMODE
x=`echo $key`

Now, I want to get value of $x as BASIC. How could I do that.

Thank you.

4
  • Or maybe INSTALLMODE=BASIC; key="$INSTALLMODE"; x="$key" (however convoluted it may be)? Commented Jul 25, 2019 at 21:00
  • Key should have keyname only, as I am using it for comparison at different place. I need a new variable with value of keyname. Commented Jul 25, 2019 at 21:21
  • 1
    In addition to the linked duplicates, see the detailed discussion in BashFAQ #6. Commented Jul 25, 2019 at 21:27
  • Fantastic. y="${!x}" worked. Thanks Charles. Commented Jul 25, 2019 at 22:25

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.