Echo (command)

In computing, codice_1 is a command that outputs the strings it is being passed as arguments. It is a command available in various operating system shells and typically used in shell scripts and batch files to output status text to the screen or a computer file, or as a source part of a pipeline.
Implementations.
The command is available in Multics, TSC FLEX, MetaComCo TRIPOS, Zilog Z80-RIO, Microware OS-9, DOS, Acorn Computers Panos, Digital Research FlexOS, IBM OS/2, Microsoft Windows, ReactOS, HP MPE/iX, KolibriOS, SymbOS, Unix and Unix-like operating systems.
Many shells, including all Bourne-like (such as Bash or zsh) and Csh-like shells as well as COMMAND.COM and cmd.exe implement codice_1 as a builtin command.
The command is also available in the EFI shell.
History.
codice_1 began within Multics. After it was programmed in C by Doug McIlroy as a "finger exercise" and proved to be useful, it became part of Version 2 Unix. codice_4 in Version 7 replaced codice_5, (which behaved like codice_1 but without terminating its output with a line delimiter).
On PWB/UNIX and later Unix System III, codice_1 started expanding C escape sequences such as codice_8 with the notable difference that octal escape sequences were expressed as codice_9 instead of codice_10 in C.
Eighth Edition Unix codice_1 only did the escape expansion when passed a codice_12 option, and that behaviour was copied by a few other implementations such as the builtin codice_1 command of Bash or zsh and GNU codice_1.
On MS-DOS, the command is available in versions 2 and later.
Nowadays, several incompatible implementations of codice_1 exist on different operating systems (often several on the same system), some of them expanding escape sequences by default, some of them not, some of them accepting options (the list of which varying with implementations), some of them not.
The POSIX Specification of codice_1 leaves the behaviour unspecified if the first argument is codice_17 or any argument contain backslash characters while the Unix specification (XSI option in POSIX) mandates the expansion of (some) sequences and does not allow any option processing. In practice, many codice_1 implementations are not compliant in the default environment.
Because of these variations in behaviour, codice_1 is considered a non-portable command on Unix-like systems and the codice_20 command (where available, introduced by Ninth Edition Unix) is preferred instead.
Usage examples.
C:\>echo Hello world
Hello world
Using ANSI escape code "SGR" sequences, compatible terminals can print out colored text.
Using a UNIX System III-style implementation:
BGRED=`echo "\033[41m"`
FGBLUE=`echo "\033[35m"`
BGGREEN=`echo "\033[42m"`
NORMAL=`echo "\033[m"`
Or a Unix Version 8-style implementation (such as Bash when not in Unix-conformance mode):
BGRED=`echo -e "\033[41m"`
FGBLUE=`echo -e "\033[35m"`
BGGREEN=`echo -e "\033[42m"`
NORMAL=`echo -e "\033[m"`
and after:
echo "${FGBLUE} Text in blue ${NORMAL}"
echo "Text normal"
echo "${BGRED} Background in red"
echo "${BGGREEN} Background in Green and back to Normal ${NORMAL}"
Portably with codice_20:
BGRED=`printf '\33[41m'`
NORMAL=`printf '\33[m'`
printf '%s\n' "${BGRED}Text on red background${NORMAL}"