Resolving Var to its contents

Hello everyone....
I am trying to dinamically create variable names and do resolution of this vars contents.
After that is done I want to use (via a function call) the var and its contents by referring to it via the variable name.
I am having a hard time achieving this .... can you help ?

Example:

#! /bin/ksh

_func2(){
emt=test1_$1
emc=test2_$1
   echo $emt
   echo $emc

emt=$emt"_EM"
emc=$emc"_EM"
   echo $emt
   echo $emc
}

Datenow=`date +%Y%m%d%H%M`
test1_x1=/dir1/test/FileOneOne_$Datenow
test1_x2=/dir1/test/FileOneTwo_$Datenow

test2_x1=/dir1/test/FileTwoOne_$Datenow
test2_x2=/dir1/test/FileTwoTwo_$Datenow

test1_x1_EM=/dir1/test/OneOne_$Datenow
test1_x2_EM=/dir1/test/OneTwo_$Datenow

test2_x1_EM=/dir1/test/TwoOne_$Datenow
test2_x2_EM=/dir1/test/TwoTwo_$Datenow

_func2  x1
_func2  x2

When I run this I get the following output, how can I get the variable to resolve to its content?

test1_x1
test2_x1
test1_x1_EM
test2_x1_EM
test1_x2
test2_x2
test1_x2_EM
test2_x2_EM

I didn't get completely, but..

emt=test1_$1
emc=test2_$1

The above can be useful only if ..

emt="$test1_$1"
emc="$test2_$1"

I suggest to please explain more about the problem.

The code

emt=test1_$1
emc=test2_$1

is used to build a string representing the variable which I want to find the contents of.
This example code might not make any practical sense, the point of it is that I would like to be able to build a var name on the fly and be able to find its contents .....
So instead of this output:

test1_x1
test2_x1
test1_x1_EM
test2_x1_EM
test1_x2
test2_x2
test1_x2_EM
test2_x2_EM

I would like to see:

/dir1/test/FileOneOne_200907201429
/dir1/test/FileTwoOne_200907201429
/dir1/test/OneOne_200907201429
/dir1/test/TwoOne_200907201429
/dir1/test/FileOneTwo_200907201429
/dir1/test/FileTwoTwo_200907201429
/dir1/test/OneTwo_200907201429
/dir1/test/TwoTwo_200907201429

Thanks.

To keep the forums high quality for all users, please take the time to format your posts correctly.

First of all, use Code Tags when you post any code or data samples so others can easily read your code. You can easily do this by highlighting your code and then clicking on the # in the editing menu. (You can also type code tags

```text
 and 
```

by hand.)

Second, avoid adding color or different fonts and font size to your posts. Selective use of color to highlight a single word or phrase can be useful at times, but using color, in general, makes the forums harder to read, especially bright colors like red.

Third, be careful when you cut-and-paste, edit any odd characters and make sure all links are working property.

Thank You.

The UNIX and Linux Forums

There needs to be another level of evaluation to achieve that, so the function part will look like the following:

_func2(){
emt=test1_$1
emc=test2_$1
eval echo \$$emt
eval echo \$$emc

emt=$emt"_EM"
emc=$emc"_EM"
eval echo \$$emt
eval echo \$$emc
}

It works well ....
Great, Thanks!