Hello all,
I'm having trouble trying to get the output of a variable passed from an INFILE. Here is what i have so far.
/tmp/INFILE --- inside INFILE will be 2 or more filenames like so
/apps/opt/FTTP_`date '+%m%d%y'`.txt
/apps/opt/DSLFeed.`date '+%m%d%y'`.txt
--Here is just a simple script to get the information
for i in `cat /tmp/INFILE`
do
if [ -f "$i" ];then
echo "$i file found"
exit 0
else
echo "$i file not found"
fi
done
Problem is i can't get the output to return the data in the file which would be FTTP_090707.txt *
All that returns is FTTP_`date '+%m%d%y'`.txt
Your help is greatly appreciated.
Thanks,
AC
Klashxx
September 7, 2007, 1:14pm
2
Try:
while read fil1
do
eval echo ${fil2}
done</tmp/INFILE|while read fil2
do
if [ -f "${fil2}" ]
then
echo "${fil2} file found"
else
echo "${fil2} file not found"
fi
done
(maybe you can get a better solution using eval)
Klashxx,
Thank you for your timely reply. The infile has lets say 2 records in that file.
/apps/opt/FTTP_`date '+%m%d%y'`.txt
/apps/opt/DSLFeed.`date '+%m%d%y'`.txt
when i'm specifing [ -f "$i" ]
i want it to return FTTP_090707.txt if the file is there. Now it's just listing FTTP_`date '+%m%d%y'`.txt
for some reason i don't know why the `date '+%m%d%y'`.txt will not pass to the variable.
Thanks,
AC