'\" t .\" Title: ccecho .\" Author: Frank Sundermeyer .\" Generator: DocBook XSL Stylesheets v1.79.1 .\" Date: 01/10/2020 .\" Manual: Conditional Color Echo .\" Source: 1.0 .\" Language: English .\" .TH "CCECHO" "1" "01/10/2020" "1\&.0" "Conditional Color Echo" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" ccecho \- ccecho (conditional color echo) lets you use colored output for STDOUT while using regular output for log files, pipes and scripts .SH "SYNOPSIS" .HP \w'\fBccecho\fR\ 'u \fBccecho\fR LEVEL MESSAGE .SH "DESCRIPTION" .PP 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\&. .PP 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)\&. .SH "PARAMETERS" .PP ccecho takes two parameters, both are mandatory: .SS "LEVEL" .PP 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"\&. .sp .if n \{\ .RS 4 .\} .nf error \-> bold red, STDERR info \-> purple, STDOUT normal \-> no color, STDOUT result \-> green, STDOUT warn \-> red, STDERR .fi .if n \{\ .RE .\} .SS "MESSAGE" .PP The message to be printed\&. Needs to be quoted using double quotes\&. You may use sequences supported by echo (1) such as \en to insert a newline and \et to insert a tab\&. .SH "ENVIRONMENT" .PP \fBCOLOR\fR .RS 4 When set to "0" or "no", ccecho will act as plain echo \-e doing no colored output\&. .RE .SH "SEE ALSO" .PP \fBecho\fR(1) .SH "AUTHOR" .PP \fBFrank Sundermeyer\fR <\&fsundermeyer@opensuse\&.org\&> .RS 4 Developer .RE