Jon*_*han 4 bash stdin while-loop readfile
我正在尝试仅从文件(output.txt)到while循环的1到1000行。
我已经尝试过这样的事情:
#!/bin/bash
while read -r line; do
echo "$line"
done < (sed -n 1,1000p data/output.txt)
Run Code Online (Sandbox Code Playgroud)
刚刚尝试过:
#!/bin/bash
while read -r line; do
echo "$line"
done < <(sed -n 1,1000p data/output.txt)
Run Code Online (Sandbox Code Playgroud)
添加另一个尖括号“ <”可以解决问题...如果有人可以解释这可能很有趣。
谢谢
| 归档时间: |
|
| 查看次数: |
1002 次 |
| 最近记录: |