Attach variable to array values

Hi All,

Need a help. I am just learning Shell scripting. Need a requirement like to attach variable to array values. Value of from is AF and to is AD.

froml=$(echo $from | tr '[a-z]' '[A-Z]')
tol=$(echo $to | tr '[a-z]' '[A-Z]')

Schemas=(AWQM WFCONTROLLER PROVCO PRISM)

for s in "${Schemas[@]}"
do 
    echo "${s}"
done

I need s should print like AWQM_AD, WFCONTROLLER_AD etc.

Please suggest me.

Thanks,
Mani

---------- Post updated at 08:06 PM ---------- Previous update was at 07:46 PM ----------

I have got it.

Thanks,
Mani

Please post your findings. It may help others. Thanks.

Hi Scott,

Everyone know how to attach variable to array values..Only i dont know how to do that... :slight_smile: Any way i have mentioned below

Schemas=(AWQM WFCONTROLLER PROVCO PRISM)

for s in "${Schemas[@]}"
do 
    sch="${s}_$tol"
        
    if [ $tol == AD ] || [ $tol == TD ];then

        echo "This is AD or TD region"
    else
        echo "This is Other Env"
    fi
done

Thanks,
Mani

Its still unclear (to me) what:
$tol and $froml contains... (actualy $to and $from)

Further, why set 'sch' to "${s}_$tol" if you dont compare it anywhere?
It has no usage, as you just compare $tol...

So actualy, you dont need the Schema's at all...