From c609b9c8d377902faa6a979eea643b239e3e4a62 Mon Sep 17 00:00:00 2001 From: Steven Baltakatei Sandoval Date: Sun, 28 Jun 2020 16:50:50 +0000 Subject: [PATCH 1/1] feat(bkgpslog):Add yell, die, try functions --- exec/bkgpslog | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/exec/bkgpslog b/exec/bkgpslog index 5cfa7cc..043dc05 100755 --- a/exec/bkgpslog +++ b/exec/bkgpslog @@ -13,7 +13,13 @@ SCRIPT_TIME_SHORT="$(date +%Y%m%dT%H%M%S%z)" # Save current date & time in ISO-8 SCRIPT_DATE_SHORT="$(date +%Y%m%d)" # Save current date in ISO-8601 format. #DIROUT1="/home/pi/Sync/Evanescent_Location" # Define output directory. -#== Function Definitions == +#== Script Function Definitions == +# Yell, Die, Try Three-Fingered Claw technique +# Ref/Attrib: https://stackoverflow.com/a/25515370 +yell() { echo "$0: $*" >&2; } +die() { yell "$*"; exit 111; } +try() { "$@" || die "cannot $*"; } + echoerr() { echo "$@" 1>&2; # Define stderr echo function. } # Define stderr message function. -- 2.30.2