Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Mac OS X > curl is confusing...

curl is confusing...
Thread Tools
Grizzled Veteran
Join Date: Jun 2001
Status: Offline
Reply With Quote
Jul 24, 2003, 06:56 AM
 
How to you retrieve multiple numerical files using curl? Even one of the examples in the man page doesn't work for me...

curl http://{site,host}.host[1-5].com -o "#1_#2"
curl: No match.

I realize the hosts don't exist, but that's besides the point.

Again...but without multiple hosts...

curl ftp://ftp.letters.com/file[1-5].txt -o "file_#1.txt"
curl: No match.

Am I doing something wrong?
     
Senior User
Join Date: Nov 2001
Location: State of Denial
Status: Offline
Reply With Quote
Jul 24, 2003, 07:51 AM
 
The problem is that the shell interprets [ and ] (and maybe { and }) before cURL can even get to them. The workaround is to quote the URL:

curl 'http://{site,host}.host[1-5].com' -o "#1_#2"
[Wevah setPostCount:[Wevah postCount] + 1];
     
Grizzled Veteran
Join Date: Jun 2001
Status: Offline
Reply With Quote
Jul 24, 2003, 08:04 AM
 
Excellent! Thank you
     
Forum Regular
Join Date: Feb 2000
Status: Offline
Reply With Quote
Jul 25, 2003, 10:25 AM
 
...you SHOULD also be able to escape the interpreted character by adding a backslash, \, in front of them:
curl http://\{site,host\}.host\[1-5\].com -o "#1_#2"

ls Temporary\ Folder

etc.

Should work pretty much anywhere those characters are interpreted by a program be it a shell, editor, etc. (Of course it also depends on how the program(s) interpret arguments, but most should work with this technique, ow you have to resort to creative quoting.)
     
Grizzled Veteran
Join Date: Jun 2001
Status: Offline
Reply With Quote
Jul 25, 2003, 10:31 AM
 
Originally posted by cutterjohn:
Should work pretty much anywhere those characters are interpreted by a program be it a shell, editor, etc. (Of course it also depends on how the program(s) interpret arguments, but most should work with this technique, ow you have to resort to creative quoting.)
Makes sense... I'll keep that in mind.
     
   
Thread Tools
Forum Links
Forum 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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 08:22 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2