1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE refentry PUBLIC
"-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.docbook.org/xml/4.5/docbookx.dtd"
[
<!ENTITY ccecho-command "ccecho">
<!ENTITY % entities SYSTEM "entity-decl.ent">
%entities;
]>
<refentry lang="en" id="ccecho">
<refentryinfo>
<authorgroup>
<author>
<contrib>Developer</contrib>
<firstname>Frank</firstname>
<surname>Sundermeyer</surname>
<email>fsundermeyer@opensuse.org</email>
</author>
</authorgroup>
</refentryinfo>
<refmeta>
<refentrytitle>&ccecho-command;</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="date">2011 June 14</refmiscinfo>
<refmiscinfo class="version">1.0</refmiscinfo>
<refmiscinfo class="manual">Conditional Color Echo</refmiscinfo>
</refmeta>
<refnamediv>
<refname>&ccecho-command;</refname>
<refpurpose>
ccecho (conditional color echo) lets you use colored output for STDOUT
while using regular output for log files, pipes and scripts
</refpurpose>
</refnamediv>
<refsynopsisdiv id="ccecho.synopsis">
<title>Synopsis</title>
<cmdsynopsis>
<command>&ccecho-command;</command>
<arg choice="plain">LEVEL</arg>
<arg choice="plain">MESSAGE</arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1 id="ccecho.description">
<title>Description</title>
<para>
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.
</para>
<para>
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).
</para>
</refsect1>
<refsect1 id="ccecho.parameters">
<title>Parameters</title>
<para>ccecho takes two parameters, both are mandatory:</para>
<refsect2 id="ccecho.parameters.level">
<title>LEVEL</title>
<para>
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".
</para>
<screen>error -> bold red, STDERR
info -> purple, STDOUT
normal -> no color, STDOUT
result -> green, STDOUT
warn -> red, STDERR</screen>
</refsect2>
<refsect2 id="ccecho.parameters.message">
<title>MESSAGE</title>
<para>
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.
</para>
</refsect2>
</refsect1>
<refsect1 id="ccecho.env">
<title>Environment</title>
<variablelist>
<varlistentry>
<term><envar>COLOR</envar></term>
<listitem>
<para>
When set to "0" or "no", &ccecho-command; will act as plain echo -e doing no
colored output.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id="ccecho.see_also">
<title>See also</title>
<para><command>echo</command>(1)</para>
</refsect1>
</refentry>
|