小编eva*_*van的帖子

while 循环中的读取行如何工作

我刚刚开始学习 shell,对 read line(variable) 命令如何读取文件感到困惑

done < filename.
Run Code Online (Sandbox Code Playgroud)

代码 :

while read LINE; do
 echo "This is a downvote"
done < inputfile
Run Code Online (Sandbox Code Playgroud)

我的假设是,当 while 运行行变量为空时,它应该为 false,而 while 循环退出,但事实并非如此。是否读取循环中的文件检查,并且我知道输入重定向命令已传递到文件。有人可以解释一下它是如何工作的吗?

bash shell while-loop io-redirection

2
推荐指数
1
解决办法
1万
查看次数

标签 统计

bash ×1

io-redirection ×1

shell ×1

while-loop ×1