120
38
So after some time of searching on Google and Super User (and scanning man pages) I was unable to find an answer to something that (I think) should be simple:
If you go here:
http://www.vim.org/scripts/script.php?script_id=2340
And try to download the theme:
http://www.vim.org/scripts/download_script.php?src_id=9750
Like so:
wget http://www.vim.org/scripts/download_script.php?src_id=9750
You’ll probably end up with a file called download_script.php?src_id=9750
.
But I want it to be called molokai.vim
, which is what would happen if I used a browser to download this file.
What options do I need to specify for wget for the desired effect?
I'd also be ok with a Curl equivalent command.
2I should've specified that this needs to be automatic – audio.zoom – 2011-06-23T12:05:31.483
As I understand it, wget relies on the web page to correctly inform it if the URL points to a file and it needs to be saved with something different, using the content disposition header, which wget may or may not fully support. So you can't do it automagically with wget. Curl may have more or less success depending on the web page. – EightBitTony – 2011-06-23T12:08:12.150
the point is to be able to script these things without complicated parsing, curl is fine but so far i haven't been able to collect decent options for that either – audio.zoom – 2011-06-23T12:14:40.477
So, running wget -S you can see the page does return a content disposition entry, Content-Disposition: attachment; filename=molokai.vim, which suggests it's not fixable. wget just isn't coping. – EightBitTony – 2011-06-23T12:19:09.393
2Aha - I'm wrong, see updated answer. This is why stackexchange sites work well - everyone learns something, even people answering the questions! – EightBitTony – 2011-06-23T12:20:35.383
Nice one - easy tools are the best – audio.zoom – 2011-06-23T12:26:39.373
Added the curl parameters that make curl work too. – EightBitTony – 2011-06-23T12:46:07.483
1This worked for me for the stackexchange podcast, which had been bugging me for a while. Thanks. – Richard Campbell – 2011-10-05T20:41:30.750