有时,make 的输出会填满屏幕。识别所有警告和错误消息行有点困难。我知道 shell 颜色输出可能会有帮助 任何人都可以帮助我吗?
最佳答案
查看colormake
,发现here
$ apt-cache search colormake
colormake - simple wrapper around make to colorize output
借助 google 的力量,我也找到了这个 bash 函数。
make()
{
pathpat="(/[^/]*)+:[0-9]+"
ccred=$(echo -e "\033[0;31m")
ccyellow=$(echo -e "\033[0;33m")
ccend=$(echo -e "\033[0m")
/usr/bin/make "$@" 2>&1 | sed -E -e "/[Ee]rror[: ]/ s%$pathpat%$ccred&$ccend%g" -e "/[Ww]arning[: ]/ s%$pathpat%$ccyellow&$ccend%g"
return ${PIPESTATUS[0]}
}
关于bash - 如何突出显示 make 输出中的警告和错误行?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6436563/