From: Steven Baltakatei Sandoval Date: Sat, 11 Jul 2020 06:39:19 +0000 (+0000) Subject: fix(bklog):Fix how procStrings and procFileExts arrays assembled X-Git-Url: https://zdv2.bktei.com/gitweb/EVA-2020-02.git/commitdiff_plain/492d1a57f8b51ef18a177551091b451f92a86cba fix(bklog):Fix how procStrings and procFileExts arrays assembled Default raw data was not being included in output file processing since procStrings and procFileExts arrays were being completely overwritten instead of being appended by argProcStrings array assembled in magicParseProcessStrings() function. --- diff --git a/exec/bklog b/exec/bklog index 5ab7fb6..38f4f3f 100644 --- a/exec/bklog +++ b/exec/bklog @@ -11,7 +11,7 @@ dirTmpDefault="/dev/shm"; # Default parent of working directory # Script Metadata scriptName="bklog"; # Define basename of script file. -scriptVersion="0.1.15"; # Define version of script. +scriptVersion="0.1.16"; # Define version of script. scriptURL="https://gitlab.com/baltakatei/ninfacyzga-01"; # Define wesite hosting this script. scriptTimeStart="$(date +%Y%m%dT%H%M%S.%N)"; # YYYYmmddTHHMMSS.NNNNNNNNN scriptHostname=$(hostname); # Save hostname of system running this script. @@ -914,28 +914,40 @@ magicParseProcessStrings() { # Validate input ## Validate argRawFileExt if [[ "$argRawFileExt" =~ ^[.][[:alnum:]]*$ ]]; then - rawFileExt="$argRawFileExt"; + rawFileExt="$argRawFileExt" && \ + vbm "DEBUG :$fn:Set rawFileExt to \"$argRawFileExt\""; + else + vbm "DEBUG :$fn:Validation failure for $argRawFileExt . Not set to rawFileExt."; fi; # Add default stdin output file entries for procStrings, procFileExts ## Check if user specified that no raw stdin be saved. if [[ ! "$optionNoStoreRaw" = "true" ]]; then ### T: --no-store-raw not set. Store raw. Append procStrings with cat. + vbm "DEBUG :$fn:--no-store-raw not set. Storing raw."; #### Append procStrings array - procStrings+=("cat "); + procStrings+=("cat ") && \ + vbm "DEBUG :$fn:Appended \"cat \" to procStrings"; + vbm "DEBUG :$fn:procStrings array:${procStrings[*]}"; #### Check if --store-raw set. if [[ "$optionStoreRaw" = "true" ]]; then ##### T: --store-raw set. Append procFileExts with user-specified file ext - procFileExts+=("$rawFileExt"); + vbm "DEBUG :$fn:--store-raw set."; + procFileExts+=("$rawFileExt") && \ + vbm "DEBUG :$fn:Appended $rawFileExt to procFileExts"; + vbm "STATUS:$fn:procFileExts array:${procFileExts[*]}"; else ##### F: --store-raw not set. Append procFileExts with default ".stdin" file ext ###### Append procFileExts array - procFileExts+=(".stdin"); + procFileExts+=(".stdin") && \ + vbm "DEBUG :$fn:Appended \".stdin\" to procFileExts"; + vbm "STATUS:$fn:procFileExts array:${procFileExts[*]}"; fi; else ### F: --no-store-raw set. Do not store raw. #### Do not append procStrings or procFileExts arrays. - : + vbm "STATUS:$fn:--no-store-raw set. Not storing raw."; + vbm "STATUS:$fn:procFileExts array:${procFileExts[*]}"; fi; # Do nothing more if optionProcString not set to true. @@ -958,8 +970,8 @@ magicParseProcessStrings() { yell "ERROR:$fn:Illegal character '-' at start of process string element:\"$element\""; exit 1; fi; done; vbm "STATUS:$fn:Quick check shows argProcStrings and argProcFileExts appear to have valid contents."; - procStrings=("${argProcStrings[@]}"); # Export process command strings - procFileExts=("${argProcFileExts[@]}"); # Export process command strings + procStrings+=("${argProcStrings[@]}"); # Export process command strings + procFileExts+=("${argProcFileExts[@]}"); # Export process command strings vbm "STATUS:$fn:Finished magicParseProcessStrings() function."; } # Validate and save process strings and file extensions to arrays procStrings, procFileExts magicParseRecipients() {