Creating a string variable name from the value of another string

Posted by NeonGlow on Stack Overflow See other posts from Stack Overflow or by NeonGlow
Published on 2012-12-05T04:59:40Z Indexed on 2012/12/05 5:03 UTC
Read the original article Hit count: 100

Filed under:
|

In my bash script I have two variables 'CONFIG_OPTION' and 'CONFIG_VALUE' which contain string VENDOR_NAME and Default_Vendor respectively.

I need to create a variable with name '$CONFIG_OPTION' ie VENDOR_NAME and assign the value in CONFIG_VALUE to newly created variable.

How I can do this?

I tried

$CONFIG_OPTION=$CONFIG_VALUE

But I am getting an error on this line as

'./Build.bash: line 137: VENDOR_NAME="Default_Vendor": command not found'

Thanks.

© Stack Overflow or respective owner

Related posts about bash

Related posts about unix