changeset 134:d3ef00af2064

add usage/help info
author Henry S. Thompson <ht@inf.ed.ac.uk>
date Wed, 14 Jul 2021 16:49:54 +0000
parents 660dc255542a
children a76cc0df2754
files bin/clm.sh
diffstat 1 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/bin/clm.sh	Wed Jul 14 16:49:35 2021 +0000
+++ b/bin/clm.sh	Wed Jul 14 16:49:54 2021 +0000
@@ -1,4 +1,18 @@
 #!/usr/bin/bash
+if [ $# -ne 1 ]
+then
+ echo "Usage:  clm.sh outfile
+Reads from stdin, which should be a complete set of HTTP header lines,
+and _appends_ either the value of the Last-Modified header or a blank
+line to the specified output file.
+
+In case of a set of headers containing more than one Last-Modified line,
+that output still consists of a single line, with all the values,
+separated by a semi-colon (;).
+
+So the output always consists of exactly one line."
+ exit 1
+fi
 egrep '^Last-Modified: ' | cut -f 2- -d ' ' | tr -d '\r' | { readarray -t a ; IFS=';' ; printf %s "${a[*]}" ; } >> "$1"
 echo >> "$1"