Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Is there a way in curl to use sequences but not give it a maximum value? So that it will download everything from the start of the sequence up?

For example:

curl ftp://ftp.vim.org/pub/vim/patches/7.3/7.3.[548-*]

or something like that?

share|improve this question
    
In Unix/Linux, the shell expands globs (like your [548-*] before the command even gets to see it. To be on the safe side, wrap the URL in single quotes. At least my curl manual gives no such option, you could try [548-] (no end) or [548-1000], if it goes only to 563 it should complain it couldn't get 564 to 1000 (but get you the ones you are interested in). –  vonbrand Mar 7 '13 at 20:04
add comment

2 Answers

Curl doesn't have an option to tell it to stop on the first error. (-f doesn't do that: curl still proceeds with the next URL on the command line.)

So let the shell handle the logic. Call curl once per URL. Stop at the first error.

n=548
while
  curl ftp://ftp.vim.org/pub/vim/patches/7.3/7.3.$n
do
  n=$((n+1))
done
share|improve this answer
add comment

Use curve expansion?

curl ftp://ftp.vim.org/pub/vim/patches/7.3/7.3.{548..1000}

share|improve this answer
add comment

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.