Bash script with env variables

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
+ (text/plain)
Delete this message
Reply to this message
Author: Eric Cope
Date:  
To: Main PLUG discussion list
Subject: Bash script with env variables
Hello all,
I was not sure how to google this, so any pointers is appreciated.

I have a file, $FILELIST with an absolute file path on every line, with the
caveat that the first portion of the path is an environment variable. For
example:

$PROJ_ROOT/path/to/file.txt
$PROJ_ROOT/path/to/another/file.txt

My script looks like this:

for file in  `cat $FILELIST`
do
        if [ -f $file ]
        then
                echo "Copying $file"
                cp -f `echo $file` $DEST/.
        else
            echo "file not found: $file"
        fi
done


The problem is that the $file is not evaluated to the path. I just get
"$PROJ_ROOT/path/to/file.txt' not found.

If I copy the text and run "more $PROJ_ROOT/path/to/file.txt" I see it just
fine.

How do I get Bash to evaluate the $PROJ_ROOT env variable for the -f $file?

Thanks,
Eric
---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss