0

How to substitue string withing string in shell

mode="create"
echo $mode

what i am trying is

echo ${CONFIG_Resource_$mode_val}

which gives me "bad substitution"

but this works fine

echo ${CONFIG_Resource_create_val}
3
  • 1
    What other variables do you have declared? I'm confused. What do you want to do? What is the desired output? Commented Dec 20, 2017 at 16:35
  • Basically I am reading yaml file and fetching the value. This works fine - ${CONFIG_Resource_create_val}... where "create" is mode" .My mode can be "create, build, run.... and so on. Commented Dec 20, 2017 at 16:37
  • so echo ${CONFIG_Resource_build_val}, echo ${CONFIG_Resource_run_val} should give me values. Commented Dec 20, 2017 at 16:38

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.