Variable names

Hi,

I have a variable v_iteration which can equal any 3 digit number eg 001 or 926

I would like to dynamically make a new variable name up using this 3 digit number

eg

v_another_variable_001=fred
v_another_variable_926=joe

The following are examples of what I have tried

v_another_variable_$v_iteration=fred
v_another_variable_"$v_iteration"=fred

and

eval v_another_variable_"$_viteration"=fred

all of which return the following error

v_another_variable_ : parameter not set

Can anyone help me with this please? I am using Korn Shell.

Many thanks
Helen

#!/bin/ksh

v_iteration=001

eval v_another_variable_${v_iteration}='fred'
echo "v_another_variable_${v_iteration} -> ${v_another_variable_001}"

v_iteration=926
eval v_another_variable_${v_iteration}='bob'
echo "v_another_variable_926 -> ${v_another_variable_926}"

Thanks vgersh

In my effort to simplify the problem, I think I got it out of context.

The actual line I'm getting the error on (and am still getting the error) is

eval v_another_variable_${v_iteration}="$v_another_variable_${v_iteration}""$v_different_variable_${v_iteration}"

I am making an attempt to append the contects of v_different_variable_$(v_iteration} on to the contents of v_another_variable_${v_iteration}

Any further help would be greatly appreciated!

Many thanks
Helen :confused: