2018-12-17 09:39:33 +08:00
|
|
|
echo - display a line of text
|
2019-01-03 12:10:47 +08:00
|
|
|
=============================
|
2018-12-17 09:39:33 +08:00
|
|
|
|
2018-12-18 09:58:24 +08:00
|
|
|
Synopsis
|
|
|
|
--------
|
2018-12-17 05:08:41 +08:00
|
|
|
|
|
|
|
echo [OPTIONS] [STRING]
|
2018-12-18 09:58:24 +08:00
|
|
|
|
2018-12-17 05:08:41 +08:00
|
|
|
|
2018-12-19 10:44:30 +08:00
|
|
|
Description
|
2019-01-03 12:10:47 +08:00
|
|
|
-----------
|
2018-12-17 05:08:41 +08:00
|
|
|
|
2018-12-20 04:02:45 +08:00
|
|
|
``echo`` displays a string of text.
|
2018-12-17 05:08:41 +08:00
|
|
|
|
|
|
|
The following options are available:
|
|
|
|
|
2018-12-20 04:02:45 +08:00
|
|
|
- ``-n``, Do not output a newline
|
2018-12-17 05:08:41 +08:00
|
|
|
|
2018-12-20 04:02:45 +08:00
|
|
|
- ``-s``, Do not separate arguments with spaces
|
2018-12-17 05:08:41 +08:00
|
|
|
|
2018-12-20 04:02:45 +08:00
|
|
|
- ``-E``, Disable interpretation of backslash escapes (default)
|
2018-12-17 05:08:41 +08:00
|
|
|
|
2018-12-20 04:02:45 +08:00
|
|
|
- ``-e``, Enable interpretation of backslash escapes
|
2018-12-17 05:08:41 +08:00
|
|
|
|
2018-12-19 10:44:30 +08:00
|
|
|
Escape Sequences
|
2019-01-03 12:10:47 +08:00
|
|
|
----------------
|
2018-12-17 05:08:41 +08:00
|
|
|
|
2018-12-20 04:02:45 +08:00
|
|
|
If ``-e`` is used, the following sequences are recognized:
|
2018-12-17 05:08:41 +08:00
|
|
|
|
2018-12-20 04:02:45 +08:00
|
|
|
- ``\`` backslash
|
2018-12-17 05:08:41 +08:00
|
|
|
|
2018-12-20 04:02:45 +08:00
|
|
|
- ``\a`` alert (BEL)
|
2018-12-17 05:08:41 +08:00
|
|
|
|
2018-12-20 04:02:45 +08:00
|
|
|
- ``\b`` backspace
|
2018-12-17 05:08:41 +08:00
|
|
|
|
2018-12-20 04:02:45 +08:00
|
|
|
- ``\c`` produce no further output
|
2018-12-17 05:08:41 +08:00
|
|
|
|
2018-12-20 04:02:45 +08:00
|
|
|
- ``\e`` escape
|
2018-12-17 05:08:41 +08:00
|
|
|
|
2018-12-20 04:02:45 +08:00
|
|
|
- ``\f`` form feed
|
2018-12-17 05:08:41 +08:00
|
|
|
|
2018-12-20 04:02:45 +08:00
|
|
|
- ``\n`` new line
|
2018-12-17 05:08:41 +08:00
|
|
|
|
2018-12-20 04:02:45 +08:00
|
|
|
- ``\r`` carriage return
|
2018-12-17 05:08:41 +08:00
|
|
|
|
2018-12-20 04:02:45 +08:00
|
|
|
- ``\t`` horizontal tab
|
2018-12-17 05:08:41 +08:00
|
|
|
|
2018-12-20 04:02:45 +08:00
|
|
|
- ``\v`` vertical tab
|
2018-12-17 05:08:41 +08:00
|
|
|
|
2018-12-20 04:02:45 +08:00
|
|
|
- ``\0NNN`` byte with octal value NNN (1 to 3 digits)
|
2018-12-17 05:08:41 +08:00
|
|
|
|
2018-12-20 04:02:45 +08:00
|
|
|
- ``\xHH`` byte with hexadecimal value HH (1 to 2 digits)
|
2018-12-17 05:08:41 +08:00
|
|
|
|
2018-12-19 10:44:30 +08:00
|
|
|
Example
|
2019-01-03 12:10:47 +08:00
|
|
|
-------
|
2018-12-17 05:08:41 +08:00
|
|
|
|
2018-12-19 11:14:04 +08:00
|
|
|
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
echo 'Hello World'
|
|
|
|
|
2018-12-17 05:08:41 +08:00
|
|
|
Print hello world to stdout
|
|
|
|
|
2018-12-19 11:14:04 +08:00
|
|
|
|
|
|
|
|
|
|
|
::
|
|
|
|
|
|
|
|
echo -e 'Top\\nBottom'
|
|
|
|
|
2018-12-17 05:08:41 +08:00
|
|
|
Print Top and Bottom on separate lines, using an escape sequence
|