bash command preserve color when piping [duplicate]
Here’s a script snippet using the colorized output of ls as an example (on Mac OS X 10.6). # no colored ls output if stdout is a pipe (and not a tty) ls -G / ls -G / | cat script -q /dev/null ls -G / | tr -d ‘\r’ | cat # write output … Read more