Shell variables problems

hi, i need some help, the situation is this

1-file of variable enviroments
DIR1=/tmp
DIR2=otherdir/mydir

2-file of list of files (all the names references whic variables of first point)

        $\{DIR1\}/$\{DIR2\}/onefile

Well now i create a shell script whic this content

              . ./file_of_env
              for file in `cat list_of_files`
              do
                 if [ -f ${file} ]
                 then
                      .....
                  else
                     ......
                  file
              done
 

Well this not work because the valor of variable "file" is :

                          $\{DIR1\}/$\{DIR2\}/onefile

but if inside the while i put and echo "$DIR1" then enviorement variable is charge.
What i'm doing wrong?
who can i make for the system make the sustituion of the enviorement variable DIR1 and DIR2?

other probe i make is chage the
. ./file_of_env

and put directly the variable definitios of DIR1 and DIR2 but tthe result is the same.

thanks.

---------- Post updated at 05:47 AM ---------- Previous update was at 04:32 AM ----------

i resolve the problem.
thread can be closed.

Please, show us how you have resolved the problem.
Something like that ?

              . ./file_of_env
              for wfile in `cat list_of_files`
              do
                 eval file=$wfile
                 if [ -f ${file} ]
                 then
                      .....
                  else
                     ......
                  file
              done

Jean-Pierre.

thanks for answer you option is so better than my.
my solution was to make a subshell inside my shell principal and execute:
something like this:

cat file_env >new_shell.sh
for fich_include in `cat list_file`
do
   buffer="$buffer $fich_include"
done

 echo "BUFFER=\"$buffer\"" >> new_shell.sh
echo "for fichero in \$BUFFER " >>new_shell.sh
 echo "do " >>new_shell
echo "if [ -f \$fichero  ]" >>new_shell
 echo "then">>new_shell
echo " echo [OK ">>new_shell
.....
sh ./new_shell

but repeat your solution is more clean and better. now i modify my script whith your option.
thanks some much.

That is a UUOC and will break the script if any filenames contain whitespace.

Thank you cfajohnson, the list of files does not contain blanks.
Normally I use :

while read line
do
....
done < file_list

i doesn't know UUOC's meaning, I it have looked in google and found other UUOC's cases that i doesn't know they are "bad code" or not optimus code, thank you very much for your contribution.

At the least, an unnecessary cat is a waste of resources (cat is an external command, and therefore much slower than using shell syntax).

At the worst, it will fail. If you use later that script on another file that does have spaces in file names, it will fail. The redirection syntax will always work, giving you a more robust script.