【发布时间】:2017-11-25 14:41:12
【问题描述】:
我正在尝试仅将文件 (output.txt) 中的第 1 到 1000 行标准输入到 while 循环中。
我尝试过这样的事情:
#!/bin/bash
while read -r line; do
echo "$line"
done < (sed -n 1,1000p data/output.txt)
【问题讨论】:
-
明确设置解释器是明智的,因为您在
bash中以#!/bin/bash或安装在您机器上的任何位置运行它
标签: bash while-loop stdin readfile