[Help-bash] How to preserve ansi color when piping (across platform)?
From:
Peng Yu
Subject:
[Help-bash] How to preserve ansi color when piping (across platform)?
Date:
Sun, 24 May 2015 21:42:46 -0500
Hi,
The following example shows how to preserver ansi color when piping.
But script is not compatible between mac and linux. Is there a way
that works across platform?
http://stackoverflow.com/questions/7641392/bash-command-preserve-color-when-piping
ls -G /
ls -G / | cat
script -q /dev/null ls -G / | tr -d '\r' | cat
# write output of script command to a variable
var="$(script -q /dev/null ls -G / | tr -d '\r' | cat)"
echo "$var"
--
Regards,
Peng