dotfiles-pub/linux/download.sh

13 lines
306 B
Bash
Raw Normal View History

2022-04-04 03:46:58 +00:00
#!/usr/bin/env bash
function download {
2022-10-21 15:38:42 +00:00
if [[ -x "$(command -v wget)" ]]; then
2022-04-04 03:46:58 +00:00
wget -qo "$2" "$1"
return $?
2022-10-21 15:38:42 +00:00
elif [[ -x "$(command -v curl)" ]]; then
curl -fsSL "$1" -o "$2"
return $?
2022-04-04 03:46:58 +00:00
fi
echo "Failed to download $1. curl or wget not installed"
return 1
}