Wget:从文件中读取URL,将数字序列添加到URL中

Adr*_*ian 4 variables bash

我正在逐行读取一个文件(带有 URL):

#!/bin/bash
while read line
do
    url=$line
    wget $url
    wget $url_{001..005}.jpg
done < $1
Run Code Online (Sandbox Code Playgroud)

首先,我想下载您所看到的主要网址wget $url。之后我想添加到数字的url序列(_001.jpg,_002.jpg,_003.jpg,_004.jpg,_005.jpg):

wget $url_{001..005}.jpg
Run Code Online (Sandbox Code Playgroud)

...但由于某种原因它不起作用。

抱歉,错过了一件事:网址就像http://xy.com/052914.jpg. 有没有简单的方法在扩展名前添加_001? http://xy.com/052914_001.jpg。或者我必须从包含 URL 的文件中删除“.jpg”,然后简单地添加到变量中?

小智 5

另一种转义下划线字符的方法:

wget $url\_{001..005}.jpg
Run Code Online (Sandbox Code Playgroud)