shell-4:while和for读取文件
while能一行一行的读# cat line.txt
1 1
2 2
3 3
4 4
# cat read.sh
#!/bin/base
cat line.txt |
while read line
do
echo $line
sleep 1
done
# sh read.sh
1 1
2 2
3 3
4 4
for 有bug
# cat line.txt
1 1
2 2
3 3
4 4
# cat read.sh
#!/bin/bash
for i in cat line.txt
do
echo $i
done
# sh read.sh
1
1
2
2
3
3
4
4
页:
[1]