小编use*_*469的帖子

在 shell 脚本中读取行 - 如何停止循环?

我在这里阅读了一个教程,我可以使用

while read line
do 
wget -x "http://someurl.com/${line}.pdf" -o ${line}.pdf
done < inputfile
Run Code Online (Sandbox Code Playgroud)

但是,此脚本继续以不包含任何值的 $line 运行。如果下一行为空或出现某些“信号”字,我该如何更改脚本停止的代码。

感谢您的帮助

shell-script

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

标签 统计

shell-script ×1