Variable substitution error

Hi
The following command gives me error :The specified substitution is not valid for this command

export DB_ID=${DB_${MART}_USER}

What is the correct syntax for the above ?

something like

DB_ID=`sh -c "echo DB_${MART}_USER"`
DB_ID=`sh -c "echo \$$DB_ID"`
export DB_ID

or you could try eval

I think you want this:

HTH.

Hi

Thanks for the suggestion but It doesnt seem to retrieve the value of the variable correctly in 2

(1)
DB_ID=`sh -c "echo DB_${MART}_USER"`

Result = DB_XMM_USER
(2)
DB_ID=`sh -c "echo \$$DB_ID"`
Result = 1233DB_ID

I need to be able to get the value of DB_XMM_USER ie ${DB_XMM_USER}

Seems you did

DB_ID=`sh -c "echo $$DB_ID"`

where $$ expanded to the current process id.

The slash prefixing the first $ is to have it taken literally.