Alternative to watch which support colors
phpunit | cat
didn't work (signalling that this is not a problem with watch
but the phpunit
command).
As an alternative, the following bash script approach worked great for me:
#!/bin/bash
while true; do
(echo -en '\033[H'
CMD="$@"
bash -c "$CMD" | while read LINE; do
echo -n "$LINE"
echo -e '\033[0K'
done
echo -en '\033[J') | tac | tac
sleep 2
done
Usage:
$ botch my-command