if [ -z "$1" ]
then
- echo 'Usage: $0 <url> [<target>]' >&2
+ echo 'Usage: $0 [-v] <url> [<target>]' >&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##*/}}
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}