From 821a18f956f258495c12427351241e7284be74cf Mon Sep 17 00:00:00 2001 From: Mischa POSLAWSKY Date: Fri, 16 Jun 2017 17:43:34 +0200 Subject: [PATCH] tools: optional verbosity for wget-ifmodified Silence target date output unless -v is specified. Build should be more quiet if not debugging. --- tools/wget-ifmodified | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) 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} -- 2.30.0