Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
嗨,我有多个文件,例如 01.pdf 02.pdf 等
在 bash 脚本中,我创建了一个 for 循环并使用 curl,但它尝试下载 1.pdf 2.pdf 等
有什么解决办法吗?
您可以使用printf填充文件名:
printf
urlbase='http://myhost.com/path/files' for i in {1..10}; do fname=$(printf "%02d.pdf\n" $i) curl -o $fname "$urlbase/$fname" done