|
@@ -25,6 +25,10 @@ if ! command -v zgrep > /dev/null 2>&1; then
|
|
|
}
|
|
|
fi
|
|
|
|
|
|
+useColor=true
|
|
|
+if [ "$NO_COLOR" = "1" ] || [ ! -t 1 ]; then
|
|
|
+ useColor=false
|
|
|
+fi
|
|
|
kernelVersion="$(uname -r)"
|
|
|
kernelMajor="${kernelVersion%%.*}"
|
|
|
kernelMinor="${kernelVersion#$kernelMajor.}"
|
|
@@ -41,6 +45,10 @@ is_set_as_module() {
|
|
|
}
|
|
|
|
|
|
color() {
|
|
|
+ # if stdout is not a terminal, then don't do color codes.
|
|
|
+ if [ "$useColor" = "false" ]; then
|
|
|
+ return 0
|
|
|
+ fi
|
|
|
codes=
|
|
|
if [ "$1" = 'bold' ]; then
|
|
|
codes='1'
|