您的位置:首页 > 运维架构 > Shell

Bash读取文件每次一行

2013-07-16 20:22 197 查看
#!/bin/bash
#read.sh

[ $# -lt 1 ]&&
{
echo Usage: read.sh filename
exit 0
}

echo 111111111111111111111111111111
while read line
do
echo $line
done < $1

echo 222222222222222222222222222222
cat $1 | while read Line
do
echo $Line
done

echo 333333333333333333333333333333
for Line in $(<$1)
do
echo $Line
done

echo 444444444444444444444444444444
for Line in $(cat $1)
do
echo $Line
done
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: