Replace the bash script variable twice

I would like to know if I can replace a variable twice.

For instance:

#global variable TEST_SERV_EXT="" #variables become from myconf.sh TEST_SERV_EXT_FO='foo01' TEST_SERV_EXT_BR='bar01' 

I want to dynamically build the last two and assign them to TEST_SERV_EXT.

I tried something like this $ {$ TEST_SERV_COMP}, but I get a "bad replacement" message.

I need something like php function "$$" or tcl subst.

Regards, thandem

+4
source share
1 answer
 TEST_SERV_COMP=TEST_SERV_EXT_FO TEST_SERV_EXT=${!TEST_SERV_COMP} 

Find indirect expansion in the bash manual.

+7
source

Source: https://habr.com/ru/post/1483127/


All Articles