Computer Science Canada

unix code

Author:  Fonzie [ Fri Nov 16, 2007 5:29 pm ]
Post subject:  unix code

I wasn't sure where to put this so I hope it's in the right place.

I'm using a scripting language for the first time and I'm using the bash shell. I'm trying to get a loop to run until a datafile given in the command line has been read through. Here's my code:

for ((i=1; i<$#+1; i++))
do

while read line
do

echo $line

done < $i
done

So what I (incorrectly) think this program should do is output every line from every datafile. However the line "done < $i" seems to have a problem. How do I easily address a variable command line argument?

Author:  HeavenAgain [ Fri Nov 16, 2007 7:37 pm ]
Post subject:  RE:unix code

have you tried removing $ sign?
in some languages it just gives the value of it
like
i = (current value)
so its not able to compare
i think Rolling Eyes

Author:  OneOffDriveByPoster [ Fri Nov 16, 2007 9:21 pm ]
Post subject:  Re: unix code

bash:
for i in "$@"


: