X-Git-Url: https://zdv2.bktei.com/gitweb/BK-2020-03.git/blobdiff_plain/3d2d59eed9b29a3a1cdbf66c69ceba5b6ce6b45f..2b263018f8d418991ea82d6996e2eb42f52502ad:/unitproc/bktemp-checkAppFileDir diff --git a/unitproc/bktemp-checkAppFileDir b/unitproc/bktemp-checkAppFileDir index e21efb9..6059be6 100644 --- a/unitproc/bktemp-checkAppFileDir +++ b/unitproc/bktemp-checkAppFileDir @@ -2,10 +2,11 @@ # Desc: Checks that apps, files, or dirs exist. #==BEGIN Define script parameters== +#===BEGIN Define variables=== declare -Ag appRollCall # Associative array for storing app status declare -Ag fileRollCall # Associative array for storing file status declare -Ag dirRollCall # Associative array for storing dir status -#==END Define script parameters== +#===END Define variables=== #===BEGIN Declare local script functions=== checkapp() { @@ -64,16 +65,18 @@ checkfile() { checkdir() { # Desc: If arg is a dir path, save result in assoc array 'dirRollCall' # Usage: checkdir arg1 arg2 arg3 ... - # Version 0.1.1 + # Version 0.1.2 # Input: global assoc. array 'dirRollCall' # Output: adds/updates key(value) to global assoc array 'dirRollCall'; - # Output: returns 0 if app found, 1 otherwise + # Output: returns 0 if all args are dirs; 1 otherwise # Depends: Bash 5.0.3 local returnState #===Process Args=== for arg in "$@"; do - if [ -d "$arg" ]; then + if [ -z "$arg" ]; then + dirRollCall["(Unspecified Dirname(s))"]="false"; returnState="false"; + elif [ -d "$arg" ]; then dirRollCall["$arg"]="true"; if ! [ "$returnState" = "false" ]; then returnState="true"; fi else