Looping through each line of text file

Dear all,

I have a text file like below.

eg.txt

abcd
efgh
ijkl
mnop

I need a script, which should read the text file eg.txt and assign each line as a parameter. This , i wil use further to pass it a java command to invoke. All inside a for loop

Need your help on this.

With Regards,
Krishna

counter=0
while read line
do
 export counter=`expr $counter + 1`
 export var${counter}=`echo $line`
done<eg.txt
echo "Variables.." $var1 $var2 $var3

The above script takes inputs in variables var1, var2, var3, etc. which you can pass to your java program.

this should be enough:
cat file | xargs