Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to download using wget a tar.gz. The file is redirected based on the url parameters, so all downloads are redirected automatically.

for example:

wget http://git.cross-lfs.org/?p=bootscripts-embedded.git;a=snapshot;h=HEAD;sf=tgz

// returns:
index.html?p=bootscripts-embedded.git

If I try to rename this to something.tar.gz and untar it, it's an invalid file.

I've tried various options such as

--content-disposition
--max-redirect=10
--recursive
--level=10

with no luck.

how can I download this file without needing something like curl?

I'm using wget version 1.12

share|improve this question
up vote 4 down vote accepted

You just need some quotes to prevent the shell from misinterpreting the semicolons...

[mpenning@tsunami ~]$ wget "http://git.cross-lfs.org/?p=bootscripts-embedded.git;a=snapshot;h=HEAD;sf=tgz"

Resolving git.cross-lfs.org... 208.97.140.69
Connecting to git.cross-lfs.org|208.97.140.69|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [application/x-gzip]
Saving to: âindex.html?p=bootscripts-embedded.git;a=snapshot;h=HEAD;sf=tgzâ

    [ <=>                                   ] 2,841       --.-K/s   in 0.001s

2014-01-07 02:24:11 (2.25 MB/s) - âindex.html?p=bootscripts-embedded.git;a=snapshot;h=HEAD;sf=tgzâ

[mpenning@tsunami ~]$ file index.html\?p\=bootscripts-embedded.git\;a\=snapshot\;h\=HEAD\;sf\=tgz
index.html?p=bootscripts-embedded.git;a=snapshot;h=HEAD;sf=tgz: 
     gzip compressed data, from Unix, last modified: Tue Jan  7 02:24:11 2014
[mpenning@tsunami ~]$
share|improve this answer
    
wow, so simple. face-palm – SnakeDoc Jan 7 '14 at 8:27
    
It's all good, everyone hits the same problem at some point in their web career ;-) – Mike Pennington Jan 7 '14 at 8:28
    
i'll accept once the timer runs out. thanks. :) – SnakeDoc Jan 7 '14 at 8:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .