X-Git-Url: https://zdv2.bktei.com/gitweb/BK-2020-03.git/blobdiff_plain/35dd69b488de578bf21dd976760f4729cf9d2a30..252ebb00f5568d5fa53cc890b08642e453585f79:/unitproc/bktemplate?ds=inline diff --git a/unitproc/bktemplate b/unitproc/bktemplate index 67fbf17..111cf7d 100755 --- a/unitproc/bktemplate +++ b/unitproc/bktemplate @@ -4,9 +4,9 @@ # Description: Template for bash scripts. # Note: Use hide-show-block function to aid readability. (ex: https://www.emacswiki.org/emacs/HideShow ). -#== Variable Initialization == +#==BEGIN Variable Initialization== -#== Global constants == +#===BEGIN Global constants=== SCRIPT_TTL=10 # Limit script life to this in seconds. PATH="/usr/local/bin/:$PATH" # Add user binary executable directory to PATH. PATH="/opt/bktei:$PATH" # Add 'optional' executable directory to PATH. @@ -14,15 +14,15 @@ SCRIPT_HOSTNAME=$(hostname) # Save hostname of system running this script. SCRIPT_VERSION="bktemplate.sh 0.0.0" # Define version of script. Used by function 'showVersion'. SCRIPT_TIME_SHORT="$(date +%Y%m%dT%H%M%S%z)" # Save current date & time in ISO-8601 format (YYYYmmddTHHMMSS+zzzz). SCRIPT_DATE_SHORT="$(date +%Y%m%d)" # Save current date in ISO-8601 format. +#===END Global constants=== -#==BEGIN Define script parameters +#===BEGIN Define script parameters declare -Ag appRollCall # Associative array for storing app status (function checkapp()) declare -Ag fileRollCall # Associative array for storing file status (function checkfile()) -#==END Define script parameters - -#== Function Definitions == - +#===END Define script parameters +#==END Variable Initialization== +#==BEGIN Function Definitions== yell() { echo "$0: $*" >&2; } # Yell, Die, Try Three-Fingered Claw technique; # Ref/Attrib: https://stackoverflow.com/a/25515370 die() { yell "$*"; exit 111; } try() { "$@" || die "cannot $*"; } @@ -408,9 +408,6 @@ checkfile() { return 1; fi } # Check that file exists - - -#== Main Program Definition == main() { # Usage: main "$@" # See [1]. # Input: unspecified (note: all Global Constants declared at beginning of script assumed to be available) @@ -470,8 +467,10 @@ main() { # End function vbm "DEBUG:main function ended." return 0; # Function finished. -} +} # Main function +#==END Function Definitions== -#== Perform work and exit == +#==BEGIN Perform work and exit== main "$@" # Run main function. exit 0; +#==END Perform work and exit==