我在Mac OS X上,无法弄清楚如何通过命令行从URL下载文件。它来自静态页面,所以我认为复制下载链接,然后使用curl
可以解决问题,但并非如此。
我引用了this StackOverflow question,但是没有用。我还引用了this article,它也没有用。
我尝试了什么:
curl -o https://github.com/jdfwarrior/Workflows.git
curl: no URL specified!
curl: try 'curl --help' or 'curl --manual' for more information
。
wget -r -np -l 1 -A zip https://github.com/jdfwarrior/Workflows.git
zsh: command not found: wget
如何通过命令行下载文件?
最佳答案
-o --output
选项意味着curl将输出写入指定的文件而不是stdout,您将url放在-o
之后,因此curl认为该URL是要写入的文件,未指定url。您需要在-o
之后的文件名,然后是URL。由于网址是基于HTTPS的,因此您可能还需要-k
选项:
curl -o ./filename -k https://github.com/jdfwarrior/Workflows.git
wget在OS X上默认不可用。