Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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 at 8:27
    
It's all good, everyone hits the same problem at some point in their web career ;-) –  Mike Pennington Jan 7 at 8:28
    
i'll accept once the timer runs out. thanks. :) –  SnakeDoc Jan 7 at 8:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.