ターミナルでERRORとかに色をつける


やりたいこと

ErrorとかWarningとかに色がつけたいよね。

.bashrcに追加

.bashrc
function highlight(){
    grep -i --color=auto -e '$' -e error -e warning -e failure $@
}

使い方

$ echo "This is error test" | highlight

This is error test

$ echo "This is error test" | highlight -e is

This is error test

参考リンク