CLI preserve colored output by making programs think they are running interactively
ls
has --color=always
, but not everyone does.
sudo apt install expect-dev
provides unbuffer
1, that when prefixed to a command makes it think it’s running in an interactive CLI, even if it’s piped or redirected etc.
For example this would preserve the colors in timew month
’s output while changing text:
unbuffer timew month 2022-02-01 - 2022-04-01 | sed "s/what/ever/g"
Nel mezzo del deserto posso dire tutto quello che voglio.
comments powered by Disqus