X-Git-Url: https://zdv2.bktei.com/gitweb/EVA-2020-02.git/blobdiff_plain/8fbca23d94a451f4e9e3bd1302ab516a019811e3..0b3dde0530513a3027de7d5f81a4386a118fce5c:/exec/bkgpslog

diff --git a/exec/bkgpslog b/exec/bkgpslog
index 0cb7f0b..9a3744a 100755
--- a/exec/bkgpslog
+++ b/exec/bkgpslog
@@ -10,7 +10,6 @@ SCRIPT_HOSTNAME=$(hostname)     # Save hostname of system running this script.
 SCRIPT_VERSION="bkgpslog 0.0.1" # Define version of script.
 SCRIPT_TIME_SHORT="$(date +%Y%m%dT%H%M%S%z)" # Save current date & time in ISO-8601 format.
 SCRIPT_DATE_SHORT="$(date +%Y%m%d)"          # Save current date in ISO-8601 format.
-DIROUT="$1"                     # Define output directory.
 
 declare -Ag appRollCall # Associative array for storing app status
 declare -Ag fileRollCall # Associative array for storing file status
@@ -30,7 +29,7 @@ checkapp() {
     #===Process Args===
     for arg in "$@"; do
 	#echo "DEBUG:processing arg:$arg"
-	if command -v $arg 1>/dev/null 2>&1; then # Check if arg is a valid command
+	if command -v "$arg" 1>/dev/null 2>&1; then # Check if arg is a valid command
 	    appRollCall[$arg]="true";
 	    #echo "DEBUG:appRollCall[$arg]:"${appRollCall[$arg]}
 	    if ! [ "$returnState" = "false" ]; then returnState="true"; fi
@@ -146,14 +145,31 @@ showVersion() {
     echoerr "$SCRIPT_VERSION"
 } # Display script version.
 vbm() {
-    if [ $OPTION_VERBOSE -eq "true" ]; then
-	echoerr "$@"
+    # Usage: vbm "DEBUG:verbose message here"
+    # Description: Prints verbose message ("vbm") to stderr if OPTION_VERBOSE is set to "true".
+    # Input:
+    #   - OPTION_VERBOSE  variable set by processArguments function. (ex: "true", "false")
+    #   - "$@"            positional arguments fed to this function.
+    # Output: stderr
+    # Script function dependencies: echoerr
+    # External function dependencies: echo
+    # Last modified: 2020-04-11T23:57Z
+    # Last modified by: Steven Baltakatei Sandoval
+    # License: GPLv3+
+    # Ref./Attrib:
+
+    if [ "$OPTION_VERBOSE" = "true" ]; then
+	FUNCTION_TIME=$(date --iso-8601=ns); # Save current time in nano seconds.
+	echoerr "[$FUNCTION_TIME] ""$*"; # Display argument text.
     fi
+
+    # End function
+    return 0; # Function finished.
 } # Verbose message display function.
 processArguments() {
     while [ ! $# -eq 0 ]; do   # While number of arguments ($#) is not (!) equal to (-eq) zero (0).
 	echoerr "DEBUG:Starting processArguments while loop."
-	echoerr "DEBUG:Provided arguments are:""$@"
+	echoerr "DEBUG:Provided arguments are:""$*"
 	case "$1" in
 	    --h | --help) showUsage; exit 1;; # Display usage.
 	    --version) showVersion; exit 1;; # Show version
@@ -208,7 +224,7 @@ dateTimeShort(){
     echo "$TIME_CURRENT_SHORT";
 } # Get date&time without separators
 main() {
-    processArguments # Process arguments.
+    processArguments "$@" # Process arguments.
     if checkapp gpspipe && checkdir "$DIROUT"; then
 	# Determine output file paths
 	FILEOUT_NMEA="$(dateTimeShort)".."$SCRIPT_HOSTNAME"_location.nmea ;