From 01514c1d4469416f0fb56db8e4644c45181746d9 Mon Sep 17 00:00:00 2001 From: kneutron <50146127+kneutron@users.noreply.github.com> Date: Wed, 7 Sep 2022 10:41:02 -0500 Subject: [PATCH] Add files via upload --- logecho.mrg | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 logecho.mrg diff --git a/logecho.mrg b/logecho.mrg new file mode 100644 index 0000000..6fd95cb --- /dev/null +++ b/logecho.mrg @@ -0,0 +1,24 @@ +#!/bin/bash +# Echo something to current console AND log +# Can also handle piped input ( cmd |logecho ) +# Warning: Has trouble echoing '*' even when quoted. +function logecho () { + args=$@ + + if [ -z "$args" ]; then + args='tmp' + + while [ 1 ]; do + read -e -t2 args + + if [ -n "$args" ]; then + echo $args |tee -a $logfile; + else + break; + fi + done + + else + echo $args |tee -a $logfile; + fi +} # END FUNC