From: Mischa POSLAWSKY Date: Fri, 16 Jun 2017 15:43:34 +0000 (+0200) Subject: tools: optional verbosity for wget-ifmodified X-Git-Tag: v1.11~42 X-Git-Url: http://git.shiar.nl/sheet.git/commitdiff_plain/821a18f956f258495c12427351241e7284be74cf tools: optional verbosity for wget-ifmodified Silence target date output unless -v is specified. Build should be more quiet if not debugging. --- diff --git a/tools/wget-ifmodified b/tools/wget-ifmodified index bae00f1..05967e1 100755 --- a/tools/wget-ifmodified +++ b/tools/wget-ifmodified @@ -4,11 +4,20 @@ set -u if [ -z "$1" ] then - echo 'Usage: $0 []' >&2 + echo 'Usage: $0 [-v] []' >&2 # download url to target location if modified exit 64 # EX_USAGE fi +verbose= + +case "$1" in +-v) + verbose=1 + shift + ;; +esac + source=$1 target=${2:-${source##*/}} @@ -16,7 +25,7 @@ if [ -e "$target" ] then modified=$(stat -c%y -L "$target") && modified=$(date -R -d "$modified") - echo download since: $modified + [ $verbose ] && echo "download since: $modified" fi headers=${modified:+If-Modified-Since: $modified}