This is a simple bash file:
this_year="$(date +%Y)"
wget -Ec "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-{modified,recent,{$this_year..2002}}.json.gz" -P gz
I’m going to download all files which names are modified
, recent
, and from $this_year
to 2002
.
The current code has this error:
root@server:~/tmp# this_year="$(date +%Y)"
wget -Ec "https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-{modified,recent,{$this_year..2002}}.json.gz" -P gz
--2024-05-17 14:14:04-- https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-%7Bmodified,recent,%7B2024..2002%7D%7D.json.gz
Resolving nvd.nist.gov (nvd.nist.gov)... 54.85.30.225, 2600:1f18:268d:1ddd:fd96:dcaa:cf17:f2b2
Connecting to nvd.nist.gov (nvd.nist.gov)|54.85.30.225|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2024-05-17 14:14:05 ERROR 404: Not Found.
I tried to do it in a for loop:
root@server:~/tmp# for i in {$this_year..2002}; do echo this is $i; done
this is {2024..2002}
root@server:~/tmp# for i in {$this_year..2002}; do https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-$i.json.gz; done
-bash: https://nvd.nist.gov/feeds/json/cve/1.1/nvdcve-1.1-{2024..2002}.json.gz: No such file or directory
How can I download based on this pattern?