现有file1、file2、file3三个文件,其内容如下
|
1
2
3
4
5
6
7
8
9
10
11
12
|
$cat file1f1_1f1_2f1_3$cat file2f2_1f2_2f2_3$cat file3f3_1f3_2f3_3 |
编写shell脚本逐行读取这三个文件
|
1
2
3
4
5
|
#!/bin/bashcat file1 file2 file3 |while read p
do
echo $p
done
|
【思考】
采用done引入多个文件,怎么实现?
#!/bin/bash
while read p
do
echo $p
done < {several_input_files}
本文转自 xoyabc 51CTO博客,原文链接:http://blog.51cto.com/xoyabc/1704973,如需转载请自行联系原作者