CCECHO(1) | Conditional Color Echo | CCECHO(1) |
ccecho - ccecho (conditional color echo) lets you use colored output for STDOUT while using regular output for log files, pipes and scripts
ccecho LEVEL MESSAGE
Prints a colored message string to STDOUT or STDERR using bash color codes. The color and the output channel depend on the LEVEL keyword. When the SHELL environment variable COLOR is set to either "0" or "no" no color output is generated.
The main purpose of this script is to provide an easy method to generate colored output when the output should go to STDOUT, and regular output (using echo -e) for log files, pipes and scripts (by exporting COLOR=0).
ccecho takes two parameters, both are mandatory:
Determines which color is used. Must be used as the first parameter. Is ignored, when the ebvironment variable COLOR is set to "0" or "no".
error -> bold red, STDERR info -> purple, STDOUT normal -> no color, STDOUT result -> green, STDOUT warn -> red, STDERR
The message to be printed. Needs to be quoted using double quotes. You may use sequences supported by echo (1) such as \n to insert a newline and \t to insert a tab.
COLOR
Frank Sundermeyer <fsundermeyer@opensuse.org>
01/24/2023 | 1.0 |