Now we’ll zoom back in to the string I/O level and examine the echo and read statements, which give the shell I/O capabilities that are more analogous to those of conventional programming languages.
As we’ve seen countless times in this book, echo simply prints its arguments to standard output. Now we’ll explore the command in greater detail.
echo accepts a few dash options, listed in Table 7.2.
Table 7-2. echo Options
Turns on the interpretation of backslash-escaped characters
Turns off the interpretation of backslash-escaped character on systems where this mode is the default
Omit the final newline (same as the \c escape sequence)
These sequences exhibit fairly predictable behavior, except for \f: on some displays, it causes a screen clear, while on others it causes a line feed. It ejects the page on most printers. \v is somewhat obsolete; it usually causes a line feed.
Table 7-3. echo Escape Sequences
|\a||ALERT or CTRL-G (bell)|
|\b||BACKSPACE or CTRL-H|
|\c||Omit final NEWLINE|
|\E||Escape character a|
|\f||FORMFEED or CTRL-L|
|\n||NEWLINE (not at end of command) or CTRL-J|
|\r||RETURN (ENTER) or CTRL-M|
|\t||TAB or CTRL-I|
|\v||VERTICAL TAB or CTRL-K|
ASCII character with octal (base-8) value ...