summary | 
shortlog | 
log | 
commit | commitdiff | 
tree
raw | 
patch | 
inline | side by side (from parent 1: 
64b184a)
 
- Note: checkfile() had "bad array subscript" error when fed a
  zero-length string as input.
 checkfile() {
     # Desc: If arg is a file path, save result in assoc array 'fileRollCall'
     # Usage: checkfile arg1 arg2 arg3 ...
 checkfile() {
     # Desc: If arg is a file path, save result in assoc array 'fileRollCall'
     # Usage: checkfile arg1 arg2 arg3 ...
     # Input: global assoc. array 'fileRollCall'
     # Output: adds/updates key(value) to global assoc array 'fileRollCall';
     # Output: returns 0 if app found, 1 otherwise
     # Input: global assoc. array 'fileRollCall'
     # Output: adds/updates key(value) to global assoc array 'fileRollCall';
     # Output: returns 0 if app found, 1 otherwise
        if [ -f "$arg" ]; then
            fileRollCall["$arg"]="true";
            if ! [ "$returnState" = "false" ]; then returnState="true"; fi;
        if [ -f "$arg" ]; then
            fileRollCall["$arg"]="true";
            if ! [ "$returnState" = "false" ]; then returnState="true"; fi;
+        elif [ -z "$arg" ]; then
+            fileRollCall["(no name)"]="false"; returnState="false";
        else
            fileRollCall["$arg"]="false"; returnState="false";
        fi;
        else
            fileRollCall["$arg"]="false"; returnState="false";
        fi;
     echo "Something is missing!";
     displayMissing;
 fi;
     echo "Something is missing!";
     displayMissing;
 fi;
+sleep 1;
+myFile=""; if ! checkfile "$myFile"; then echo "An empty argument provided:$myFile"; displayMissing; fi;
 #==END sample code==
 
 # Author: Steven Baltaktei Sandoval
 #==END sample code==
 
 # Author: Steven Baltaktei Sandoval