From: Steven Baltakatei Sandoval Date: Fri, 10 Jul 2020 03:31:11 +0000 (+0000) Subject: style(unitproc):dateShort: Change VAR_NAMES to varNames X-Git-Tag: 0.3.0~30 X-Git-Url: https://zdv2.bktei.com/gitweb/BK-2020-03.git/commitdiff_plain/26961aa383b3e915cd0a83b8d76d8dc864e70dc7?hp=--cc style(unitproc):dateShort: Change VAR_NAMES to varNames --- 26961aa383b3e915cd0a83b8d76d8dc864e70dc7 diff --git a/unitproc/bktemp-dateShort b/unitproc/bktemp-dateShort index b4e4464..4212b35 100644 --- a/unitproc/bktemp-dateShort +++ b/unitproc/bktemp-dateShort @@ -8,33 +8,33 @@ try() { "$@" || die "cannot $*"; } #o dateShort(){ # Desc: Date without separators (YYYYmmdd) # Usage: dateShort ([str date]) - # Version: 1.1.0 + # Version: 1.1.1 # Input: arg1: 'date'-parsable timestamp string (optional) # Output: stdout: date (ISO-8601, no separators) # Depends: yell - local TIME_CURRENT DATE_CURRENT_SHORT + local argTime timeCurrent timeInput dateCurrentShort argTime="$1"; # Get Current Time - TIME_CURRENT="$(date --iso-8601=seconds)" ; # Produce `date`-parsable current timestamp with resolution of 1 second. + timeCurrent="$(date --iso-8601=seconds)" ; # Produce `date`-parsable current timestamp with resolution of 1 second. # Decide to parse current or supplied date ## Check if time argument empty if [[ -z "$argTime" ]]; then ## T: Time argument empty, use current time - TIME_INPUT="$TIME_CURRENT"; + timeInput="$timeCurrent"; else ## F: Time argument exists, validate time if date --date="$argTime" 1>/dev/null 2>&1; then ### T: Time argument is valid; use it - TIME_INPUT="$argTime"; + timeInput="$argTime"; else ### F: Time argument not valid; exit yell "ERROR:Invalid time argument supplied. Exiting."; exit 1; fi fi # Construct and deliver separator-les date string - DATE_CURRENT_SHORT="$(date -d "$TIME_INPUT" +%Y%m%d)"; # Produce separator-less current date with resolution 1 day. - echo "$DATE_CURRENT_SHORT"; + dateCurrentShort="$(date -d "$timeInput" +%Y%m%d)"; # Produce separator-less current date with resolution 1 day. + echo "$dateCurrentShort"; } # Get YYYYmmdd #==BEGIN sample code==