Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- download_file() {
- # Download a file with the preferred downloader
- # first arg $1 is the URL
- # second arg $2 is the output file
- if [[ $downloader =~ .+wget$ ]]
- then
- # wget
- if "$downloader -c -O $2 -- $1"
- then
- return 0
- else
- return 1
- fi
- else # we can just else instead of elif since we know we have curl
- # curl
- if "$downloader -L $1 -o $2"
- then
- return 0
- else
- return 1
- fi
- fi
- }
- download_file_simple() {
- # Download a file with the preferred downloader
- # first arg $1 is the URL
- # second arg $2 is the output file
- if [[ $downloader =~ .+wget$ ]]
- then
- # wget
- if "$downloader -c -- $1"
- then
- return 0
- else
- return 1
- fi
- else # we can just else instead of elif since we know we have curl
- # curl
- if "$downloader -L $1"
- then
- return 0
- else
- return 1
- fi
- fi
- }
Add Comment
Please, Sign In to add comment