improve bin tool script shell variable use
We export shell variables where needed. We print debug messages of shell variables in the order they were exported or declared, except for the USAGE shell variable, for those shell variables that were exported or declared prior to the set of debug messages of shell variables. Changed `bin/chk-entry.sh` VERSION from "1.1.3 2024-03-18" to "1.1.4 2024-03-26". Changed `bin/gen-authors.sh` VERSION from "1.3.1 2024-03-18" to "1.3.2 2024-03-26". Changed `bin/gen-location.sh` VERSION from "1.1.1 2024-03-18" to "1.1.2 2024-03-26". Changed `bin/gen-other-html.sh` VERSION from "1.0.1 2024-03-08" to "1.0.2 2024-03-26". Changed `bin/gen-sitemap.sh` VERSION from "1.3.2 2024-03-18" to "1.3.3 2024-03-26". Changed `bin/gen-status.sh` VERSION from "1.1.1 2024-03-18" to "1.1.2 2024-03-26". Changed `bin/gen-years.sh` VERSION from "1.0.2 2024-03-13" to "1.0.3 2024-03-26". Changed `bin/md2html.sh` VERSION from "1.1.1 2024-03-09" to "1.1.2 2024-03-26". Changed `bin/output-index-author.sh` VERSION from "1.5.1 2024-03-19" to "1.5.2 2024-03-26". Changed `bin/output-index-inventory.sh` VERSION from "1.2.2 2024-03-19" to "1.2.3 2024-03-26". Changed `bin/output-year-index.sh` VERSION from "1.1.1 2024-03-19" to "1.1.2 2024-03-26". Changed `bin/pandoc-wrapper.sh` VERSION from "1.5.2 2024-03-19" to "1.5.3 2024-03-26". Changed `bin/quick-readme2index.sh` VERSION from "1.1.2 2024-03-08" to "1.1.3 2024-03-26". Changed `bin/readme2index.sh` VERSION from "1.2.1 2024-02-23" to "1.2.2 2024-02-26". Changed `bin/sort.gitignore.sh` VERSION from "1.1.2 2024-03-18" to "1.1.3 2024-03-26". Changed `bin/status2html.sh` VERSION from "1.1.1 2024-03-19" to "1.1.2 2024-03-26". Changed `bin/subst.default.sh` VERSION from "1.2.1 2024-02-23" to "1.2.2 2024-02-26". Changed `bin/subst.entry-index.sh` VERSION from "1.3.1 2024-03-19" to "1.3.2 2024-03-26". Changed `bin/tar-all.sh` VERSION from "1.1.1 2024-03-18" to "1.1.2 2024-03-26". Changed `bin/tar-entry.sh` VERSION from "1.3.1 2024-03-25" to "1.3.2 2024-03-26". Changed `bin/tar-year.sh` VERSION from "1.1.1 2024-03-18" to "1.1.2 2024-03-26". Changed `bin/all-years.sh` VERSION from "1.0.1 2024-02-23" to "1.0.2 2024-02-26". Changed `bin/gen-top-html.sh` VERSION from "1.2.1 2024-03-08" to "1.2.2 2024-03-26". Changed `bin/gen-year-index.sh` VERSION from "1.0.3 2024-03-09" to "1.0.4 2024-03-26". Changed `bin/subst.year-index.sh` VERSION from "1.1.1 2024-03-19" to "1.1.2 2024-03-26". Changed `bin/untar-entry.sh` VERSION from "1.0 2024-03-25" to "1.0.1 2024-03-26".
This commit is contained in:
1 parent
0834d59263
commit
c176b51cec
27 files changed
+285
-178
No files matched your search
+10
-8
@@ -84,7 +84,7 @@ shopt -s globstar # enable ** to match all files and zero or more directories an
|
||||
|
||||
# set variables referenced in the usage message
|
||||
#
|
||||
export VERSION="1.3.2 2024-03-18"
|
||||
export VERSION="1.3.3 2024-03-26"
|
||||
NAME=$(basename "$0")
|
||||
export NAME
|
||||
export V_FLAG=0
|
||||
@@ -478,11 +478,14 @@ if [[ $V_FLAG -ge 3 ]]; then
|
||||
echo "$0: debug[3]: GIT_TOOL=$GIT_TOOL" 1>&2
|
||||
echo "$0: debug[3]: TOPDIR=$TOPDIR" 1>&2
|
||||
echo "$0: debug[3]: REPO_URL=$REPO_URL" 1>&2
|
||||
echo "$0: debug[3]: SITE_URL=$SITE_URL" 1>&2
|
||||
echo "$0: debug[3]: CAP_W_FLAG_FOUND=$CAP_W_FLAG_FOUND" 1>&2
|
||||
echo "$0: debug[3]: MODTIME_METHOD=$MODTIME_METHOD" 1>&2
|
||||
echo "$0: debug[3]: NOOP=$NOOP" 1>&2
|
||||
echo "$0: debug[3]: DO_NOT_PROCESS=$DO_NOT_PROCESS" 1>&2
|
||||
echo "$0: debug[3]: CAP_W_FLAG_FOUND=$CAP_W_FLAG_FOUND" 1>&2
|
||||
echo "$0: debug[3]: EXIT_CODE=$EXIT_CODE" 1>&2
|
||||
echo "$0: debug[3]: REPO_NAME=$REPO_NAME" 1>&2
|
||||
echo "$0: debug[3]: CD_FAILED=$CD_FAILED" 1>&2
|
||||
echo "$0: debug[3]: ARCHIVE_HISTORIC_PATH=$ARCHIVE_HISTORIC_PATH" 1>&2
|
||||
echo "$0: debug[3]: ARCHIVE_HISTORIC_DIR=$ARCHIVE_HISTORIC_DIR" 1>&2
|
||||
echo "$0: debug[3]: AUTHOR_PATH=$AUTHOR_PATH" 1>&2
|
||||
@@ -491,11 +494,9 @@ if [[ $V_FLAG -ge 3 ]]; then
|
||||
echo "$0: debug[3]: BIN_DIR=$BIN_DIR" 1>&2
|
||||
echo "$0: debug[3]: INC_PATH=$INC_PATH" 1>&2
|
||||
echo "$0: debug[3]: INC_DIR=$INC_DIR" 1>&2
|
||||
echo "$0: debug[3]: YEAR_DIR=$YEAR_DIR" 1>&2
|
||||
echo "$0: debug[3]: SITEMAP=$SITEMAP" 1>&2
|
||||
echo "$0: debug[3]: FILELIST_ENTRY_JSON_AWK=$FILELIST_ENTRY_JSON_AWK" 1>&2
|
||||
echo "$0: debug[3]: FILELIST=$FILELIST" 1>&2
|
||||
echo "$0: debug[3]: MODTIME_METHOD=$MODTIME_METHOD" 1>&2
|
||||
echo "$0: debug[3]: TOP_FILE=$TOP_FILE" 1>&2
|
||||
fi
|
||||
|
||||
# If -N, time to exit
|
||||
@@ -509,7 +510,7 @@ fi
|
||||
|
||||
# create a temporary file manifest list
|
||||
#
|
||||
TMP_MANIFEST_LIST=".$NAME.$$.manifest.list"
|
||||
export TMP_MANIFEST_LIST=".$NAME.$$.manifest.list"
|
||||
if [[ $V_FLAG -ge 3 ]]; then
|
||||
echo "$0: debug[3]: temporary file manifest list: $TMP_MANIFEST_LIST" 1>&2
|
||||
fi
|
||||
@@ -530,7 +531,7 @@ fi
|
||||
# It is a pain to set the EXIT_CODE deep inside a loop, so we write the EXIT_CODE into a file
|
||||
# and read the file (setting EXIT_CODE again) after the loop. A hack, but good enough for our needs.
|
||||
#
|
||||
TMP_EXIT_CODE=".$NAME.$$.exit.code"
|
||||
export TMP_EXIT_CODE=".$NAME.$$.exit.code"
|
||||
if [[ $V_FLAG -ge 3 ]]; then
|
||||
echo "$0: debug[3]: temporary exit code: $TMP_EXIT_CODE" 1>&2
|
||||
fi
|
||||
@@ -548,7 +549,7 @@ fi
|
||||
|
||||
# create a temporary sitemap
|
||||
#
|
||||
TMP_SITEMAP=".$NAME.$$.sitemap"
|
||||
export TMP_SITEMAP=".$NAME.$$.sitemap"
|
||||
if [[ $V_FLAG -ge 3 ]]; then
|
||||
echo "$0: debug[3]: temporary tarball: $TMP_SITEMAP" 1>&2
|
||||
fi
|
||||
@@ -863,6 +864,7 @@ if [[ -z $NOOP ]]; then
|
||||
#
|
||||
LC_ALL=C sort -d -f -u -t / "$TMP_MANIFEST_LIST" | while read -r FILE_PATH; do
|
||||
LASTMOD=$(output_modtime "$FILE_PATH")
|
||||
export LASTMOD
|
||||
echo '<url>'
|
||||
echo " <loc>$SITE_URL/$FILE_PATH</loc>"
|
||||
echo " <lastmod>$LASTMOD</lastmod>"
|
||||
|
||||
Reference in new issue
Block a user