From e9450946a2e09c19bd1919838da096855edb169c Mon Sep 17 00:00:00 2001 From: Atlas Cove Date: Thu, 11 May 2023 14:11:13 +0100 Subject: [PATCH] update gensimap.sh added extra error checking code --- gensimap.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gensimap.sh b/gensimap.sh index f23437a..8852bb6 100755 --- a/gensimap.sh +++ b/gensimap.sh @@ -2,8 +2,13 @@ # gensimap.sh: Generate a sitemap for my website. # v2.0p1 function inf { 1>&2 echo -e "\x1B[1;32mINF\x1B[0m: $*"; } +function err { 1>&2 echo -e "\x1B[1;31mERR\x1B[0m: $*"; } function r { echo $@ >> out/sitemap.xml; } inf "Generating Sitemap..." +if ! test -d out; then + err "Directory 'out' not created, cannot write sitemap." + exit 1 +fi if test -f out/sitemap.xml; then inf "Overwriting current sitemap..." sed -i d sitemap.xml