在 bash 脚本中,我尝试使用单个命令(无循环)使用自定义文件名并行下载多个文件。
我尝试使用 aria2c:
aria2c -j2 URL1 URL2 # BAD: outputs to a single file
aria2c -j2 -Z URL1 -o 1 URL2 -o 2 # BAD: filenames taken from link (-o is ignored)
第二个忽略输出文件名,因为引用 aria2c 联机帮助页:
在 Metalink 或 BitTorrent 下载中,您不能指定文件名。此处指定的文件名仅在提供给 aria2 的 URI 由命令行完成时使用,而没有 --input-file, --force-sequential 选项。例如:
$ aria2c -o myfile.zip “ http://example1.com/file.zip ” “ http://example2.com/file.zip ”
这是我要避免的:
aria2c URL1 -o 1 &
aria2c URL2 -o 2 &
aria2c URL3 -o 3 # BAD: slow and ugly, because aria2c is called thrice
有什么建议么?