I'm running a
watch on a command to monitor the number of open connections for a service we're diagnosing. I need to keep an eye on it while doing other work, to help other developers identify when the service is acting up.
The result of the watch is a number between 1 and 5000. I'd like to show the number as green when it's below 500, yellow when its between 501 and 4000, and red for above 4000.
Is there a command which can set the color easily based on the value of my command?