04/01/27 12:45
簡単にやるとしたらこんな感じかな。ただ、端末周りを扱うプログラムで支障が
あるかもね。
% cat ./tored
tored () {
local line
while read line; do
print "\e[31;1m$line\e[0m"
done
}
% source ./tored
% perl -e 'printf STDERR "this is stderr.\n"'
this is stderr.
% perl -e 'printf STDERR "this is stderr.\n"' | tored
this is stderr.
% perl -e 'printf STDERR "this is stderr.\n"' 2>&1 | tored
this is stderr.
% exec 2> >(tored)
% perl -e 'printf STDERR "this is stderr.\n"'
this is stderr.
# 色は省略しています