Create a gist now

Instantly share code, notes, and snippets.

curl_install
# 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"
return
elif [[ $# == 1 ]]; then
local url=$1
local file="/usr/local/bin/"${url##*/}
elif [[ $# == 2 ]] ; then
local url=$1
local file=$2
fi
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