Bashコマンドラインでstderr(エラー出力)を色付けする方法について紹介します。
color()(set -o pipefail;"$@" 2>&1>&3|sed
[bash: print stderr in red color - Server Fault](https://serverfault.com/questions/59262/bash-print-stderr-in-red-color)
s,.*,\e[31m&\e[m,'>&2)3>&1
# e.g.
# color sudo apt update
bash: print stderr in red color - Server Fault
このように、color()関数を定義して、sedコマンドで色付けしています。
Bashのコマンドラインで色付けを活用して、作業効率を上げましょう。
以上です。