Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# downloads a file specified by first parameter, puts it to /usr/local/bin (or second parameter) and gives it +x permissions
curl_install() {
if [[ $# == 0 ]]; then
echo "At least one parameter (url) is required"
elif [[ $# == 1 ]]; then
local url=$1
local file="/usr/local/bin/"${url##*/}
elif [[ $# == 2 ]] ; then
local url=$1
local file=$2
echo "Installing $url to $file ..."
sudo curl -L -o $file $url && sudo chmod +x $file
echo "Done!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment