LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-20-2011, 10:09 PM   #1
tofumon
LQ Newbie
 
Registered: Mar 2011
Distribution: Ubuntu
Posts: 3

Rep: Reputation: 0
Wget Scheme missing


I'm trying to write a shell script to help me download a bunch of .zip files with dynamic address

Code:
for((i=100;i<120;i++))
do
	wget "'http://foo/get_file.php?file_name=bar_$i.zip'"
done
However, whenever I run this wget gives me the following error
Code:
'http://foo/get_file.php?file_name=bar_$i.zip': Scheme missing.
What does the error message mean? How can I fix my script?

Thanks in advance
 
Old 03-22-2011, 08:05 AM   #2
amani
Senior Member
 
Registered: Jul 2006
Location: Kolkata, India
Distribution: Debian 64-bit GNU/Linux, Kubuntu64, Fedora QA, Slackware,
Posts: 2,766

Rep: Reputation: Disabled
use the -A option with file extn instead?
 
Old 03-22-2011, 02:46 PM   #3
tofumon
LQ Newbie
 
Registered: Mar 2011
Distribution: Ubuntu
Posts: 3

Original Poster
Rep: Reputation: 0
That doesn't appear to be the problem

Code:
wget 'http://foo/get_file.php?file_name=bar_100.zip'
wget -A.zip 'http://foo/get_file.php?file_name=bar_100.zip'
both appear to work.

However,

Code:
wget -A.zip "'http://foo/get_file.php?file_name=bar_100.zip'"
won't work. Which leads me to believe that the problem is related to the double quotes. However they are necessary because I'm using it to interpret the $i variable.
 
Old 03-23-2011, 06:51 AM   #4
Guttorm
Senior Member
 
Registered: Dec 2003
Location: Trondheim, Norway
Distribution: Debian and Ubuntu
Posts: 1,453

Rep: Reputation: 447Reputation: 447Reputation: 447Reputation: 447Reputation: 447
Hi

Yes, the double quoting is the problem. Remove the ' ones and it should work. The error message means that wget gets the argument 'http://foo/get_file.php?file_name=bar_100.zip' - scheme missing means that it expects the argument to be http/ftp/https and so on, and 'https in no scheme.

wget -A.zip "http://foo/get_file.php?file_name=bar_100.zip"
 
Old 03-24-2011, 10:54 AM   #5
tofumon
LQ Newbie
 
Registered: Mar 2011
Distribution: Ubuntu
Posts: 3

Original Poster
Rep: Reputation: 0
Yea. It appears as though I was getting the need for single quotes mixed up. I thought that single quotes was required by wget to figure out what to do with dynamic addresses. Actually it's because stuff like shell is trying to interpret the ? and & that commonly show up in dynamic addresses and the single quotes are there to prevent shell from doing it.

Another fix I found was to make it as such:

Code:
wget -A.zip 'http://foo/get_file.php?file_name='bar_$i.zip
so that it won't get confused by the other things in the dynamic address but will still know to interpret the $i.

Thanks for your help. Is there anyway to change the title to solved or something to that effect?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
wget not working! but "man wget is" ??? wrapster Solaris / OpenSolaris 5 07-30-2008 03:00 AM
Password generation failed for scheme {CRYPT}: scheme not recognized olva Linux - General 0 11-05-2006 11:21 AM
wget missing url ergo_sum Linux - Newbie 2 06-07-2005 07:35 PM
Backup scheme brentos Linux - General 5 07-13-2004 07:02 PM
Partitioning scheme pcdebb Linux - Newbie 1 01-20-2004 10:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:55 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration