篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了markdown shell I / O.相关的知识,希望对你有一定的参考价值。
#### Reading from more than one file at a time
[linux - Looping through the content of a file in Bash - Stack Overflow](https://stackoverflow.com/questions/1521462/looping-through-the-content-of-a-file-in-bash)
```shell
while read -u 3 -r line1 && read -u 4 -r line2; do
# process the lines
# note that the loop will end when we reach EOF on either of the files, because of the `&&`
done 3< input1.txt 4< input2.txt
```
##### Reading a whole file into an array (Bash versions 4x and later)
```shell
readarray -t my_array < my_file
for line in "${my_array[@]}"; do
# process the lines
done
```
以上是关于markdown shell I / O.的主要内容,如果未能解决你的问题,请参考以下文章