Sign up ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I'm trying to download multiple urls from different domains using different proxies.

It should do all these in one row of code, running curl just once:

do shell script "curl --proxy"
do shell script "curl --proxy"
do shell script "curl --proxy"

This fails:

do shell script "curl --proxy"

Taking the code from an answer below I tried to run

set url_list to ""

do shell script "xargs curl --proxy < " & url_list

but this fails as well.

share|improve this question
How does the second example fail (error message etc.)? And to the question as a whole: What do you expect from running the three downloads in one row of code? Do you want to run them in parallel? – patrix May 11 '13 at 7:04
There is no need to run parallel. – user49147 May 11 '13 at 10:56
What is the motivation to have it all in "one row of code" then? – patrix May 11 '13 at 11:00

1 Answer 1

When you have a long URL or multiples, use xargs instead:

do shell script "xargs curl --proxy < url-list.txt"

share|improve this answer
Shouldn't you also pass -L 1 -P 3 to xargs as well to ensure that curl is called correctly and that xargs runs the downloads in parallel? – patrix May 11 '13 at 7:20
@patrix, yes I normally would, although the op didn't have any of those args in their original command - so maybe they didn't want any reattempts. Proxy tunnel args are only necessary if not using HTTP protocol. – l'L'l May 11 '13 at 13:08
I would pass them to xargs, not to curl. – patrix May 11 '13 at 13:45
lol, ironic how those args still apply to the question in the curl aspect - but yes xargs eof and output is helpful no doubt and sorry i didn't notice that in your original comment. – l'L'l May 11 '13 at 13:49

Your Answer


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.