add red STDERR output

This commit is contained in:
olli 2023-01-17 08:52:56 +01:00
parent 8f254e85f9
commit 67c48188ad

View File

@ -38,3 +38,14 @@ g_syslogtag="g_bash-script:$g_scriptname[$$]"
# PATH # PATH
[ -d /etc/thinclient/scripts ] && PATH=$PATH:/etc/thinclient/scripts [ -d /etc/thinclient/scripts ] && PATH=$PATH:/etc/thinclient/scripts
# red STDERR output
exec 9>&2
exec 8> >(
while IFS='' read -r line || [ -n "$line" ]; do
echo -e "\033[31m${line}\033[0m"
done
)
function undirect(){ exec 2>&9; }
function redirect(){ exec 2>&8; }
trap "redirect;" DEBUG
PROMPT_COMMAND='undirect;'