I've given portion of the script here to explain the problem.
It will accept 2 input parameters .
in_file1=$1
in_file2=$2
outbound_dir=/home/outbound
for i in 1 2
do
eval file$i=$outbound_dir/\$in_file$i
eval echo "filename is \$file$i"
eval temp_file=$outbound_dir/\$in_file$i
eval FILE$i_LINE_COUNT=`wc -l < $temp_file`
eval echo "Total lines in file$i are \$FILE$i_LINE_COUNT"
done
echo "file1 name outside loop is $file1"
echo "file1 count outside loop is $FILE1_LINE_COUNT"
When i am displaying file1 and $FILE1_LINE_COUNT variables inside the loop its giving correct values.
But ouside the loop getting correct value for only file1 variable not getting for $FILE1_LINE_COUNT variable.
In any case, this has nothing to do with the loop specifically. Replace
eval FILE$i_LINE_COUNT=`wc -l < $temp_file`
with
eval FILE${i}_LINE_COUNT=`wc -l < $temp_file`
You were assigning the word count output to $FILE since $i_LINE_COUNT was undefined. Surround the 'i' with curly braces to distinguish it from the rest of the line.