aboutsummaryrefslogtreecommitdiff
path: root/doc/usage
diff options
context:
space:
mode:
authorHeinrich Schuchardt2021-01-21 17:33:44 +0100
committerHeinrich Schuchardt2021-01-25 01:15:33 +0100
commit750ff62da7e76e2c71a782853c52c0a863b40d5d (patch)
treec5ba53f9d4ac768b108e4ad7bdf3578ebeb5c39a /doc/usage
parentc0445c18d3cd97b6ebc81355d239efefe771f0aa (diff)
doc: document echo command
Provide a man-page for the echo command. Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'doc/usage')
-rw-r--r--doc/usage/echo.rst65
-rw-r--r--doc/usage/index.rst1
2 files changed, 66 insertions, 0 deletions
diff --git a/doc/usage/echo.rst b/doc/usage/echo.rst
new file mode 100644
index 00000000000..861abdfd1eb
--- /dev/null
+++ b/doc/usage/echo.rst
@@ -0,0 +1,65 @@
+echo command
+============
+
+Synopsis
+--------
+
+::
+
+ echo [-n] [args ...]
+
+Description
+-----------
+
+The echo command prints its arguments to the console separated by spaces.
+
+-n
+ Do not print a line feed after the last argument.
+
+args
+ Arguments to be printed. The arguments are evaluated before being passed to
+ the command.
+
+Examples
+--------
+
+Strings are parsed before the arguments are passed to the echo command:
+
+::
+
+ => echo "a" 'b' c
+ a b c
+ =>
+
+Observe how variables included in strings are handled:
+
+::
+
+ => setenv var X; echo "a)" ${var} 'b)' '${var}' c) ${var}
+ a) X b) ${var} c) X
+ =>
+
+
+-n suppresses the line feed:
+
+::
+
+ => echo -n 1 2 3; echo a b c
+ 1 2 3a b c
+ => echo -n 1 2 3
+ 1 2 3=>
+
+A more complex example:
+
+::
+
+ => for i in a b c; do for j in 1 2 3; do echo -n "${i}${j}, "; done; echo; done;
+ a1, a2, a3,
+ b1, b2, b3,
+ c1, c2, c3,
+ =>
+
+Return value
+------------
+
+The return value $? is always set to 0 (true).
diff --git a/doc/usage/index.rst b/doc/usage/index.rst
index 6f49652758f..317db3b449a 100644
--- a/doc/usage/index.rst
+++ b/doc/usage/index.rst
@@ -17,6 +17,7 @@ Shell commands
bootefi
bootmenu
button
+ echo
exit
for
mbr