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 +} +