Skip to content

Instantly share code, notes, and snippets.

@trscavo
trscavo / cget.sh
Last active January 6, 2020 22:54
Shell script to retrieve a web resource via HTTP Conditional GET
#!/bin/bash
#####################################################################
# Retrieve a web resource via HTTP Conditional GET [RFC 7232] and
# output the resource on stdout. Cache the web resource and consult
# the cache on subsequent requests for the same resource. By default,
# return the cached resource (if it exists) if and only if the web
# server responds with 304 Not Modified.
#
# Usage: cget.sh [-vfcH] URL