Last Updated: February 25, 2016
·
662
· jasonseney

Shell Function to Download File

Tired of trying to remember the flags and parameter order for curl or wget? Use this quick function in your bash profile:

function download {
    $(which curl) -o ${1##*/} $1
}

Usage: download http://raw.github.com/someproject/master/somefile.js

Downloads somefile.js to the current directory.


Credit to jacedominiak for suggesting a function instead of a script.

2 Responses
Add your response

could be done as a shell function as well, one file less to maintain:

function download {
    $(which curl) -o ${1##*/} $1
}
over 1 year ago ·

@jacedominiak - Yes, you're right, much better in a function, thanks!

over 1 year ago ·