From c6773044e05d5e4506bbcbe922cf86b05787eec8 Mon Sep 17 00:00:00 2001 From: trscavo Date: Thu, 13 Oct 2016 18:10:01 -0400 Subject: [PATCH 1/6] Create README.md --- README.md | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..06a0d95 --- /dev/null +++ b/README.md @@ -0,0 +1,31 @@ +# Bash Library + +A library of re-usable bash scripts + +## Installation + +Download the source, change directory to the source directory, and install the source into ``/tmp`` as follows: + +```Shell +$ export BIN_DIR=/tmp/bin +$ export LIB_DIR=/tmp/lib +$ ./install.sh $BIN_DIR $LIB_DIR +``` + +or install into your home directory: + +```Shell +$ export BIN_DIR=$HOME/bin +$ export LIB_DIR=$HOME/lib +$ ./install.sh $BIN_DIR $LIB_DIR +``` + +An installation directory will be created if it doesn't already exist. + +## Compatibility + +These scripts are compatible with GNU/Linux and Mac OS. + +## Dependencies + +None From 4c6b9fbcfa032ab51638f7c5e3122e86e620ca42 Mon Sep 17 00:00:00 2001 From: Tom Scavo Date: Fri, 14 Oct 2016 12:26:17 -0400 Subject: [PATCH 2/6] Add contents section to README.md --- README.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 06a0d95..687acae 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,22 @@ A library of re-usable bash scripts +## Contents + +Executables: + +* cget.sh + +Library files: + +* command_paths.sh +* compatible_date.sh +* compatible_mktemp.sh +* conditional_get.sh +* extract_entity.xsl +* http_tools.sh +* md_tools.sh + ## Installation Download the source, change directory to the source directory, and install the source into ``/tmp`` as follows: @@ -24,7 +40,7 @@ An installation directory will be created if it doesn't already exist. ## Compatibility -These scripts are compatible with GNU/Linux and Mac OS. +Shell scripts are compatible with GNU/Linux and Mac OS. XSLT scripts are written in XSLT 1.0. ## Dependencies From 2667b71514648ed39cbbb9eb1b0446609c2f0ff6 Mon Sep 17 00:00:00 2001 From: Tom Scavo Date: Sat, 15 Oct 2016 14:33:48 -0400 Subject: [PATCH 3/6] Minor edits to README.md --- README.md | 34 ++++++++++++++++------------------ 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 687acae..ede6324 100644 --- a/README.md +++ b/README.md @@ -2,22 +2,6 @@ A library of re-usable bash scripts -## Contents - -Executables: - -* cget.sh - -Library files: - -* command_paths.sh -* compatible_date.sh -* compatible_mktemp.sh -* conditional_get.sh -* extract_entity.xsl -* http_tools.sh -* md_tools.sh - ## Installation Download the source, change directory to the source directory, and install the source into ``/tmp`` as follows: @@ -36,11 +20,25 @@ $ export LIB_DIR=$HOME/lib $ ./install.sh $BIN_DIR $LIB_DIR ``` -An installation directory will be created if it doesn't already exist. +A target directory will be created if one doesn't already exist. The following files will be installed: + +```Shell +$ ls -1 $BIN_DIR +cget.sh + +$ ls -1 $LIB_DIR +command_paths.sh +compatible_date.sh +compatible_mktemp.sh +conditional_get.sh +extract_entity.xsl +http_tools.sh +md_tools.sh +``` ## Compatibility -Shell scripts are compatible with GNU/Linux and Mac OS. XSLT scripts are written in XSLT 1.0. +Shell scripts are compatible with both GNU/Linux and Mac OS. XSLT scripts are written in XSLT 1.0. ## Dependencies From 60a3317817473bf1f0475cce56f00cf990dd9662 Mon Sep 17 00:00:00 2001 From: Tom Scavo Date: Mon, 17 Oct 2016 10:58:17 -0400 Subject: [PATCH 4/6] Add overview section --- README.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/README.md b/README.md index ede6324..4bcecd3 100644 --- a/README.md +++ b/README.md @@ -36,6 +36,16 @@ http_tools.sh md_tools.sh ``` +## Overview + +Bash script ``cget.sh`` retrieves and caches HTTP resources on disk. A previously cached resource is retrieved via HTTP Conditional GET [RFC 7232]. If the web server responds with HTTP 200 OK, the resource is cached and written to stdout. If the web server responds with 304 Not Modified, the cached resource is written to stdout instead. + +See the inline help file for details: + +```Shell +$ $BIN_DIR/cget.sh -h +``` + ## Compatibility Shell scripts are compatible with both GNU/Linux and Mac OS. XSLT scripts are written in XSLT 1.0. From c007ad426e578859fcf26067b1007b97789efd15 Mon Sep 17 00:00:00 2001 From: Tom Scavo Date: Mon, 17 Oct 2016 13:34:01 -0400 Subject: [PATCH 5/6] Add example to overview section --- README.md | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4bcecd3..163fdf9 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ $ export LIB_DIR=$HOME/lib $ ./install.sh $BIN_DIR $LIB_DIR ``` -A target directory will be created if one doesn't already exist. The following files will be installed: +A given target directory will be created if one doesn't already exist. In any case, the following files will be installed: ```Shell $ ls -1 $BIN_DIR @@ -38,7 +38,28 @@ md_tools.sh ## Overview -Bash script ``cget.sh`` retrieves and caches HTTP resources on disk. A previously cached resource is retrieved via HTTP Conditional GET [RFC 7232]. If the web server responds with HTTP 200 OK, the resource is cached and written to stdout. If the web server responds with 304 Not Modified, the cached resource is written to stdout instead. +Bash script ``cget.sh`` retrieves and caches HTTP resources on disk. A previously cached resource is retrieved via HTTP Conditional GET [RFC 7232]. If the web server responds with HTTP 200 OK, the resource is cached and written to stdout. If the web server responds with 304 Not Modified, the cached resource is output instead. + +```Shell +$ MD_LOCATION=http://md.incommon.org/InCommon/InCommon-metadata.xml +$ CACHE_DIR=/tmp/http_cache +$ $BIN_DIR/cget.sh $MD_LOCATION > /dev/null +$ echo $? +0 +$ ls -1 $CACHE_DIR +885d2eedcad7d0355da5bb9e648833ec_content +885d2eedcad7d0355da5bb9e648833ec_headers +$ cat /tmp/http_cache/885d2eedcad7d0355da5bb9e648833ec_headers +HTTP/1.1 200 OK +Date: Mon, 17 Oct 2016 17:26:58 GMT +Server: Apache +Last-Modified: Fri, 14 Oct 2016 19:07:55 GMT +ETag: "190004-24ddf06-53ed7f18d18c0" +Accept-Ranges: bytes +Content-Length: 38657798 +Connection: close +Content-Type: application/samlmetadata+xml +``` See the inline help file for details: From efafb11aeba995e9d246c55760696f267bf480c5 Mon Sep 17 00:00:00 2001 From: Tom Scavo Date: Mon, 17 Oct 2016 13:37:29 -0400 Subject: [PATCH 6/6] Fix bug in example --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 163fdf9..90cdf90 100644 --- a/README.md +++ b/README.md @@ -42,14 +42,14 @@ Bash script ``cget.sh`` retrieves and caches HTTP resources on disk. A previousl ```Shell $ MD_LOCATION=http://md.incommon.org/InCommon/InCommon-metadata.xml -$ CACHE_DIR=/tmp/http_cache +$ export CACHE_DIR=/tmp/http_cache $ $BIN_DIR/cget.sh $MD_LOCATION > /dev/null $ echo $? 0 $ ls -1 $CACHE_DIR 885d2eedcad7d0355da5bb9e648833ec_content 885d2eedcad7d0355da5bb9e648833ec_headers -$ cat /tmp/http_cache/885d2eedcad7d0355da5bb9e648833ec_headers +$ cat $CACHE_DIR/885d2eedcad7d0355da5bb9e648833ec_headers HTTP/1.1 200 OK Date: Mon, 17 Oct 2016 17:26:58 GMT Server: Apache