Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I found this tip super helpful, for using curl to resume an interrupted file copy.

The full syntax is:

curl -C - -O file:///Volumes/path/to/file

I would like to add an alias or function called resume to my .bash_profile (on Mac) so that I can use something like

resume /Volumes/disk1/file

I was going to try something like

function resume() { ... }

but I'm not sure how to pass the argument with the file:/// prefix.

share|improve this question

Functions receive parameters just like scripts, so you can use $1 to refer to the first argument passed:

resume () {
  curl -C - -O "file://$1"

Note that you don't need both function and the parens; either one tells bash that it's a function.

share|improve this answer
That doesn't seem to work, probably because there are spaces in the path. If I do resume /Volumes/Disk\ 1/Dir\ 1/File\ 1 then curl returns curl: (37) Couldn't open file /Volumes/Disk followed by a bunch of HTML code! – Ze'ev Sep 21 '12 at 5:18
You can put quotes around the argument curl -C - -O "file://$1" – Matteo Sep 21 '12 at 5:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .