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