Created
January 8, 2023 23:59
-
-
Save GeorgeTsiokos/058b58eea604d8e3ce2b8a9321fd922c to your computer and use it in GitHub Desktop.
curl 7.68 download with eTag support
This file contains 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
# ====================== | |
# curl-download.sh v1.0 | |
# filename | |
# url | |
# ====================== | |
if [ -f "$1.etag" ]; then | |
HTTPCODE=$(curl --etag-compare $1.etag --url $2 -o $1 -sw '%{http_code}' --retry 9) | |
if [ "$HTTPCODE" = "304" ]; then | |
echo "$1: not modified" | |
exit 0 | |
fi | |
echo "$1: modified" | |
else | |
echo "$1: 1st download" | |
fi | |
curl --etag-save $1.etag --url $2 -o $1 --no-progress-meter --retry 9 --dump-header $1.header | |
cat $1.header |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment