Last active
June 17, 2020 20:33
-
-
Save colorwebdesigner/c59bc9588ec05e073db8a25798633d62 to your computer and use it in GitHub Desktop.
check curl or wget is install and dowload with progress bar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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