文章标签 » make

给make的错误信息加点颜色

~/.bashrc

make()
{
    ccred=$(echo -e "\033[0;31m")
    ccyellow=$(echo -e "\033[0;33m")
    ccend=$(echo -e "\033[0m")
    /Applications/Xcode.app/Contents/Developer/usr/bin/make "$@" 2>&1 | sed -E -e "/[Ee]rror[: ]/ s%(.*)%$ccred&$ccend%g" -e "/[Ww]arning[: ]/ s%(.*)%$ccyellow&$ccend%g"
    return ${PIPESTATUS[0]}
}

屏幕快照 2013-09-05 下午2.10.14
嗯,错误信息醒目多了,原版在这里
http://stackoverflow.com/questions/6436563/how-can-i-highlight-the-warning-and-error-lines-int-the-make-output