From 4b7e7ff1c3eef4ead3df810015a9195f62b53860 Mon Sep 17 00:00:00 2001 From: Steven Baltakatei Sandoval Date: Sat, 11 Jul 2020 01:08:43 +0000 Subject: [PATCH 1/1] style(unitproc):setTimeZoneEV: semicolons, version numbers --- unitproc/bktemp-setTimeZoneEV | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/unitproc/bktemp-setTimeZoneEV b/unitproc/bktemp-setTimeZoneEV index 0855c1e..f51e16a 100644 --- a/unitproc/bktemp-setTimeZoneEV +++ b/unitproc/bktemp-setTimeZoneEV @@ -8,29 +8,28 @@ try() { "$@" || die "cannot $*"; } setTimeZoneEV(){ # Desc: Set time zone environment variable TZ # Usage: setTimeZoneEV arg1 - # Version 0.1.2 - # Input: arg1: 'date'-compatible timezone string (ex: "America/New_York") + # Version 0.1.3 + # In : arg1: 'date'-compatible timezone string (ex: "America/New_York") # TZDIR env var (optional; default: "/usr/share/zoneinfo") - # Output: exports TZ + # Out: exports TZ (env var) # exit code 0 on success # exit code 1 on incorrect number of arguments # exit code 2 if unable to validate arg1 - # Depends: yell(), printenv 8.30, bash 5.0.3 - # Tested on: Debian 10 + # Depends: bash 5.0.3, printenv 8.30, yell() local tzDir returnState argTimeZone - argTimeZone="$1" + argTimeZone="$1"; if ! [[ $# -eq 1 ]]; then yell "ERROR:Invalid argument count."; return 1; - fi + fi; # Read TZDIR env var if available if printenv TZDIR 1>/dev/null 2>&1; then tzDir="$(printenv TZDIR)"; else tzDir="/usr/share/zoneinfo"; - fi + fi; # Validate TZ string if ! [[ -f "$tzDir"/"$argTimeZone" ]]; then @@ -39,12 +38,12 @@ setTimeZoneEV(){ else # Export ARG1 as TZ environment variable TZ="$argTimeZone" && export TZ && returnState="true"; - fi + fi; # Determine function return code if [ "$returnState" = "true" ]; then return 0; - fi + fi; } # Exports TZ environment variable #==BEGIN sample code== -- 2.30.2