- Note: displayMissing() function returns with exit code 0 if nothing
missing, 1 otherwise.
displayMissing() {
# Desc: Displays missing apps, files, and dirs
# Usage: displayMissing
displayMissing() {
# Desc: Displays missing apps, files, and dirs
# Usage: displayMissing
# Input: associative arrays: appRollCall, fileRollCall, dirRollCall
# Output: stderr: messages indicating missing apps, file, or dirs
# Input: associative arrays: appRollCall, fileRollCall, dirRollCall
# Output: stderr: messages indicating missing apps, file, or dirs
+ # Output: returns exit code 0 if nothing missing; 1 otherwise
# Depends: bash 5, checkAppFileDir()
local missingApps value appMissing missingFiles fileMissing
local missingDirs dirMissing
# Depends: bash 5, checkAppFileDir()
local missingApps value appMissing missingFiles fileMissing
local missingDirs dirMissing
#==BEGIN Display errors==
#===BEGIN Display Missing Apps===
missingApps="Missing apps :";
#==BEGIN Display errors==
#===BEGIN Display Missing Apps===
missingApps="Missing apps :";
#===END Display Missing Directories===
#==END Display errors==
#===END Display Missing Directories===
#==END Display errors==
+ #==BEGIN Determine function return code===
+ if [ "$appMissing" == "true" ] || [ "$fileMissing" == "true" ] || [ "$dirMissing" == "true" ]; then
+ return 1;
+ else
+ return 0;
+ fi
+ #==END Determine function return code===
} # Display missing apps, files, dirs
#===END Declare local script functions===
} # Display missing apps, files, dirs
#===END Declare local script functions===
#==BEGIN sample code==
if checkapp cat; then echo "cat found."; fi;
if checkapp gpg; then echo "gpg found."; fi;
#==BEGIN sample code==
if checkapp cat; then echo "cat found."; fi;
if checkapp gpg; then echo "gpg found."; fi;
+if displayMissing 1>/dev/null 2>&1; then
+ echo "Nothing missing so far...";
+fi;
+
if checkapp emaaaacs; then echo "emaaaacs found."; fi;
sleep 1;
if checkapp emaaaacs; then echo "emaaaacs found."; fi;
sleep 1;
+if ! displayMissing 1>/dev/null 2>&1; then
+ echo "Something is missing!";
+ displayMissing;
+fi;
#==END sample code==
# Author: Steven Baltaktei Sandoval
#==END sample code==
# Author: Steven Baltaktei Sandoval