How can I highlight the warning and error lines in the make output?

前端 未结 7 2184
醉话见心
醉话见心 2021-01-30 11:19

Sometimes, make\'s output fills the screen. It\'s a little bit hard to identify all the warning and error message lines. I know may shell color output can help Can anyone can he

7条回答
  •  情深已故
    2021-01-30 11:31

    Just another bash function , much concise

    make()
    {
      /usr/bin/make "$@" 2>&1 | sed -E -e "s/error/ $(echo -e "\\033[31m" ERROR "\\033[0m"/g)"   -e "s/warning/ $(echo -e "\\033[0;33m" WARNING "\\033[0m"/g)"
      return ${PIPESTATUS[0]}
    }
    

提交回复
热议问题