如何使用 wget 从各个链接下载多个文件

use*_*980 2 scripting bash shell-script

假设我有各种想要下载的图像,并且有可用的链接:

https://images.unsplash.com/photo-1548363585-5b1241ee3b85?ixlib=rb-1.2.1&auto=format&fit=crop&w=634&q=80

https://images.unsplash.com/photo-1556648011-e01aca870a81?ixlib=rb-1.2.1&auto=format&fit=crop&w=634&q=80

我不想一一输入

wget https://images.unsplash.com/photo-1548363585-5b1241ee3b85?ixlib=rb-1.2.1&auto=format&fit=crop&w=634&q=80

wget https://images.unsplash.com/photo-1556648011-e01aca870a81?ixlib=rb-1.2.1&auto=format&fit=crop&w=634&q=80
Run Code Online (Sandbox Code Playgroud)

我怎样才能实现这个目标?我读到,将这些链接保存在 .txt 文件中并使用 for 循环不是正确的方法。

Fre*_*ddy 5

如果您的文件中有这样的 URL:

https://images.unsplash.com/photo-1548363585-5b1241ee3b85?ixlib=rb-1.2.1&auto=format&fit=crop&w=634&q=80
https://images.unsplash.com/photo-1556648011-e01aca870a81?ixlib=rb-1.2.1&auto=format&fit=crop&w=634&q=80
Run Code Online (Sandbox Code Playgroud)

然后你就可以跑了

wget --input-file=file
Run Code Online (Sandbox Code Playgroud)

按照@Kusalananda的描述下载图像。