It is very easy to read "words" in a bash script. But what if you want to read a line in a text file? I have this problem today, After some googling, I found a interesting way to do this.
while read l
do
echo $l
done < xxx.txt
It use the xxx.txt as input, and the read command in bash will read the input line by line.
No comments:
Post a Comment