Skip to content

Instantly share code, notes, and snippets.

@colorwebdesigner
Last active June 17, 2020 20:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save colorwebdesigner/c59bc9588ec05e073db8a25798633d62 to your computer and use it in GitHub Desktop.
Save colorwebdesigner/c59bc9588ec05e073db8a25798633d62 to your computer and use it in GitHub Desktop.
check curl or wget is install and dowload with progress bar
#!/bin/bash
# ============================
# Found in install.sh from dnote
# https://github.com/dnote/dnote/blob/master/install.sh
# ============================
http_download() {
dest=$1
srcURL=$2
if is_command curl; then
cmd='curl -L --progress-bar'
destflag='-o'
elif is_command wget; then
cmd='wget -q --show-progress'
destflag='-O'
else
print_error "unable to find wget or curl. please install and try again."
exit 1
fi
$cmd $destflag "$dest" "$srcURL"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment