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}
pythonhmmm
  • 833
  • 1
  • 18
  • 38
  • 1
    What other variables do you have declared? I'm confused. What do you want to do? What is the desired output? – Benjamin W. Dec 20 '17 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. – pythonhmmm Dec 20 '17 at 16:37
  • so echo ${CONFIG_Resource_build_val}, echo ${CONFIG_Resource_run_val} should give me values. – pythonhmmm Dec 20 '17 at 16:38

0 Answers0