diff options
author | TheFightingCatfish <seekingblues@gmail.com> | 2021-08-25 23:57:02 +0800 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-31 16:49:45 +0200 |
commit | c9b384da92fb7e86dbb5bad82392c76139e30948 (patch) | |
tree | 8c56f2c6120a14acb872949716257ba48b027330 /Base/usr/share | |
parent | c2f62a03ff25fdaebabd054ee69800bf3885ee97 (diff) | |
download | serenity-c9b384da92fb7e86dbb5bad82392c76139e30948.zip |
echo: Support octal, hexadecimal and unicode escape sequences
Diffstat (limited to 'Base/usr/share')
-rw-r--r-- | Base/usr/share/man/man1/echo.md | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/Base/usr/share/man/man1/echo.md b/Base/usr/share/man/man1/echo.md index ac891ed8c1..a66411c0ae 100644 --- a/Base/usr/share/man/man1/echo.md +++ b/Base/usr/share/man/man1/echo.md @@ -5,21 +5,51 @@ echo - print the given text ## Synopsis ```**sh -$ echo [-n] text... +$ echo [-ne] [text...] ``` ## Description -Print the given *text*, which is passed as argv, to the standard output, -separating arguments with a space character. +Print the given `text` to the standard output. If multiple `text`s are provided, they will be joined with a space character. If no `text` is provided, an empty line will be printed. + +Character escape sequences and their meanings are as follows: + +`\\a` - `<alert>` + +`\\b` - `<backspace>` + +`\\c` - Suppress the output of all remaining characters, including the trailing newline. + +`\\e` - The escape character (`\\033`). + +`\\f` - `<form-feed>` + +`\\n` - `<newline>` + +`\\r` - `<carriage-return>` + +`\\t` - `<tab>` + +`\\v` - `<vertical-tab>` + +`\\\\` - The backslash character (`\\`). + +`\\0ooo` - A byte whose value is a zero, one, two, or three-digit octal number. + +`\\xHH` - A byte whose value is a two-digit hexadecimal number. + +`\\uHHHH` - An unicode code point whose value is a four-digit hexadecimal number. ## Options * `-n`: Do not output a trailing newline +* `-e`: Interpret backslash escapes ## Examples ```sh $ echo hello friends! hello friends! +$ echo -ne '\x68\x65\x6c\x6c\x6f' 'friends\041\n' +hello friends! ``` |