Re: reading lines of a file in a shell script ?




Michael Tosch wrote:
atishay wrote:
oops small mistake in last mail

cat filename | \
while read currentline
do
echo $currentline
done

Alberto wrote:

I want to read 1 by 1 a line of a file in a bash shell script. What
could I do ?
I know I can see the file with eg. cat, but: what could I do to
"process" each line of the file ?

Thanks
Alberto



And why do you propose

cat filename | loop

when you can do

loop < filename
i agree, this ia another improvement possible in the script

?

Last but not least,

echo "$currentline"

should be "quoted", so shell does variable substitution but
no other expansions.
i would like to know what other expansions could the shell do when
there is no quote(") ?
thanks/atishay


--
Michael Tosch @ hp : com

.



Relevant Pages