From 30e739b08c0371f166c506f015f1dcaa0da7d3cf Mon Sep 17 00:00:00 2001 From: kneutron <50146127+kneutron@users.noreply.github.com> Date: Fri, 9 Apr 2021 15:25:51 -0500 Subject: [PATCH] Add files via upload --- commasep-num.mrg | 12 ++++++++++++ failexit.mrg | 6 ++++++ 2 files changed, 18 insertions(+) create mode 100644 commasep-num.mrg create mode 100644 failexit.mrg diff --git a/commasep-num.mrg b/commasep-num.mrg new file mode 100644 index 0000000..8597f8c --- /dev/null +++ b/commasep-num.mrg @@ -0,0 +1,12 @@ +#!/bin/bash + +# REF: https://unix.stackexchange.com/questions/113795/add-thousands-separator-in-a-number + +function commanum () { + LC_NUMERIC=en_US printf "%'.f" $1 +} + +# test for interactive shell / OK to echo text +#[ $(echo $- |grep i |wc -l) -gt 0 ] && +[ ! "$1" = "" ] && commanum $1 +#echo $1 \ No newline at end of file diff --git a/failexit.mrg b/failexit.mrg new file mode 100644 index 0000000..7a15146 --- /dev/null +++ b/failexit.mrg @@ -0,0 +1,6 @@ +# failexit.mrg +function failexit () { + echo '! Something failed! Code: '"$1 $2" # code # (and optional description) + exit $1 +} +