summaryrefslogtreecommitdiff
path: root/doc/usage/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'doc/usage/cmd')
-rw-r--r--doc/usage/cmd/acpi.rst4
-rw-r--r--doc/usage/cmd/bootdev.rst4
-rw-r--r--doc/usage/cmd/bootflow.rst4
-rw-r--r--doc/usage/cmd/bootmeth.rst4
-rw-r--r--doc/usage/cmd/cbsysinfo.rst4
-rw-r--r--doc/usage/cmd/cedit.rst4
-rw-r--r--doc/usage/cmd/cli.rst4
-rw-r--r--doc/usage/cmd/dm.rst4
-rw-r--r--doc/usage/cmd/fdt.rst4
-rw-r--r--doc/usage/cmd/font.rst4
-rw-r--r--doc/usage/cmd/for.rst4
-rw-r--r--doc/usage/cmd/history.rst4
-rw-r--r--doc/usage/cmd/host.rst4
-rw-r--r--doc/usage/cmd/if.rst72
-rw-r--r--doc/usage/cmd/md.rst4
-rw-r--r--doc/usage/cmd/mtrr.rst4
-rw-r--r--doc/usage/cmd/panic.rst4
-rw-r--r--doc/usage/cmd/part.rst4
-rw-r--r--doc/usage/cmd/sf.rst4
-rw-r--r--doc/usage/cmd/sm.rst4
-rw-r--r--doc/usage/cmd/trace.rst4
-rw-r--r--doc/usage/cmd/ut.rst4
22 files changed, 114 insertions, 42 deletions
diff --git a/doc/usage/cmd/acpi.rst b/doc/usage/cmd/acpi.rst
index a630f1ec5e3..9f30972fe53 100644
--- a/doc/usage/cmd/acpi.rst
+++ b/doc/usage/cmd/acpi.rst
@@ -6,8 +6,8 @@
acpi command
============
-Synopis
--------
+Synopsis
+--------
::
diff --git a/doc/usage/cmd/bootdev.rst b/doc/usage/cmd/bootdev.rst
index 658020e7c7f..f759abab354 100644
--- a/doc/usage/cmd/bootdev.rst
+++ b/doc/usage/cmd/bootdev.rst
@@ -6,8 +6,8 @@
bootdev command
===============
-Synopis
--------
+Synopsis
+--------
::
diff --git a/doc/usage/cmd/bootflow.rst b/doc/usage/cmd/bootflow.rst
index 16ba986dc8a..6519e4880a9 100644
--- a/doc/usage/cmd/bootflow.rst
+++ b/doc/usage/cmd/bootflow.rst
@@ -6,8 +6,8 @@
bootflow command
================
-Synopis
--------
+Synopsis
+--------
::
diff --git a/doc/usage/cmd/bootmeth.rst b/doc/usage/cmd/bootmeth.rst
index 95651fdc7c5..2903977ee54 100644
--- a/doc/usage/cmd/bootmeth.rst
+++ b/doc/usage/cmd/bootmeth.rst
@@ -6,8 +6,8 @@
bootmeth command
================
-Synopis
--------
+Synopsis
+--------
::
diff --git a/doc/usage/cmd/cbsysinfo.rst b/doc/usage/cmd/cbsysinfo.rst
index 8c03a85169d..80d8ba1b662 100644
--- a/doc/usage/cmd/cbsysinfo.rst
+++ b/doc/usage/cmd/cbsysinfo.rst
@@ -3,8 +3,8 @@
cbsysinfo
=========
-Synopis
--------
+Synopsis
+--------
::
diff --git a/doc/usage/cmd/cedit.rst b/doc/usage/cmd/cedit.rst
index b39d708281d..5670805a00e 100644
--- a/doc/usage/cmd/cedit.rst
+++ b/doc/usage/cmd/cedit.rst
@@ -6,8 +6,8 @@
cedit command
=============
-Synopis
--------
+Synopsis
+--------
::
diff --git a/doc/usage/cmd/cli.rst b/doc/usage/cmd/cli.rst
index 81487722f69..23e5ee7a902 100644
--- a/doc/usage/cmd/cli.rst
+++ b/doc/usage/cmd/cli.rst
@@ -6,8 +6,8 @@
cli command
===========
-Synopis
--------
+Synopsis
+--------
::
diff --git a/doc/usage/cmd/dm.rst b/doc/usage/cmd/dm.rst
index 9bef2eeaed8..7651507937a 100644
--- a/doc/usage/cmd/dm.rst
+++ b/doc/usage/cmd/dm.rst
@@ -6,8 +6,8 @@
dm command
==========
-Synopis
--------
+Synopsis
+--------
::
diff --git a/doc/usage/cmd/fdt.rst b/doc/usage/cmd/fdt.rst
index 3e8c32cdea3..71a9fc627e5 100644
--- a/doc/usage/cmd/fdt.rst
+++ b/doc/usage/cmd/fdt.rst
@@ -6,8 +6,8 @@
fdt command
===========
-Synopis
--------
+Synopsis
+--------
::
diff --git a/doc/usage/cmd/font.rst b/doc/usage/cmd/font.rst
index adcd5126d0a..a8782546333 100644
--- a/doc/usage/cmd/font.rst
+++ b/doc/usage/cmd/font.rst
@@ -6,8 +6,8 @@
font command
============
-Synopis
--------
+Synopsis
+--------
::
diff --git a/doc/usage/cmd/for.rst b/doc/usage/cmd/for.rst
index 4c98419b28f..729bd4db43c 100644
--- a/doc/usage/cmd/for.rst
+++ b/doc/usage/cmd/for.rst
@@ -4,8 +4,8 @@
for command
===========
-Synopis
--------
+Synopsis
+--------
::
diff --git a/doc/usage/cmd/history.rst b/doc/usage/cmd/history.rst
index 564a1596655..b52b5b220ae 100644
--- a/doc/usage/cmd/history.rst
+++ b/doc/usage/cmd/history.rst
@@ -6,8 +6,8 @@
history command
===============
-Synopis
--------
+Synopsis
+--------
::
diff --git a/doc/usage/cmd/host.rst b/doc/usage/cmd/host.rst
index 072497db903..a70a432b6f2 100644
--- a/doc/usage/cmd/host.rst
+++ b/doc/usage/cmd/host.rst
@@ -6,8 +6,8 @@
host command
============
-Synopis
--------
+Synopsis
+--------
::
diff --git a/doc/usage/cmd/if.rst b/doc/usage/cmd/if.rst
new file mode 100644
index 00000000000..6b3dbe7b0a0
--- /dev/null
+++ b/doc/usage/cmd/if.rst
@@ -0,0 +1,72 @@
+.. SPDX-License-Identifier: GPL-2.0-or-later
+
+.. index::
+ single: if (command)
+
+if command
+==========
+
+Synopsis
+--------
+
+::
+
+ if <test statement>
+ then
+ <statements>
+ fi
+
+ if <test statement>
+ then
+ <statements>
+ else
+ <statements>
+ fi
+
+Description
+-----------
+
+The if command is used to conditionally execute statements.
+
+test statement
+ Any command. The test statement set the $? variable. If the value of
+ $? becomes 0 (true) the statements after the **then** statement will
+ be executed. Otherwise the statements after the **else** statement.
+
+Example
+-------
+
+The examples shows how the value of a numeric variable can be tested with
+**itest**.
+
+::
+
+ => a=1; if itest $a == 0; then echo true; else echo false; fi
+ false
+ => a=0; if itest $a == 0; then echo true; else echo false; fi
+ true
+
+In the following example we try to load an EFI binary via TFTP. If loading
+succeeds, the binary is executed.
+
+::
+
+ if tftp $kernel_addr_r shellriscv64.efi; then bootefi $kernel_addr_r; fi
+
+Return value
+------------
+
+The value of $? is the return value of the last executed statement.
+
+::
+
+ => if true; then true; else true; fi; echo $?
+ 0
+ => if false; then true; else true; fi; echo $?
+ 0
+ => if false; then false; else false; fi; echo $?
+ 1
+ => if true; then false; else false; fi; echo $?
+ 1
+ => if false; then true; fi; echo $?
+ 1
diff --git a/doc/usage/cmd/md.rst b/doc/usage/cmd/md.rst
index 9ea148a8dca..9a9919f9ad0 100644
--- a/doc/usage/cmd/md.rst
+++ b/doc/usage/cmd/md.rst
@@ -6,8 +6,8 @@
md command
==========
-Synopis
--------
+Synopsis
+--------
::
diff --git a/doc/usage/cmd/mtrr.rst b/doc/usage/cmd/mtrr.rst
index c65618950bc..3c5c3ba3d43 100644
--- a/doc/usage/cmd/mtrr.rst
+++ b/doc/usage/cmd/mtrr.rst
@@ -6,8 +6,8 @@
mtrr command
============
-Synopis
--------
+Synopsis
+--------
mtrr [list]
mtrr set <reg> <type> <start> <size>
diff --git a/doc/usage/cmd/panic.rst b/doc/usage/cmd/panic.rst
index ba5ea626108..39d32adbc99 100644
--- a/doc/usage/cmd/panic.rst
+++ b/doc/usage/cmd/panic.rst
@@ -6,8 +6,8 @@
panic command
=============
-Synopis
--------
+Synopsis
+--------
::
diff --git a/doc/usage/cmd/part.rst b/doc/usage/cmd/part.rst
index 58be38781e3..e7faeccbb09 100644
--- a/doc/usage/cmd/part.rst
+++ b/doc/usage/cmd/part.rst
@@ -6,8 +6,8 @@
part command
============
-Synopis
--------
+Synopsis
+--------
::
diff --git a/doc/usage/cmd/sf.rst b/doc/usage/cmd/sf.rst
index 24d5dc692db..dfdca46e66c 100644
--- a/doc/usage/cmd/sf.rst
+++ b/doc/usage/cmd/sf.rst
@@ -6,8 +6,8 @@
sf command
==========
-Synopis
--------
+Synopsis
+--------
::
diff --git a/doc/usage/cmd/sm.rst b/doc/usage/cmd/sm.rst
index b767647d772..e828fddc519 100644
--- a/doc/usage/cmd/sm.rst
+++ b/doc/usage/cmd/sm.rst
@@ -6,8 +6,8 @@
sm command
==========
-Synopis
--------
+Synopsis
+--------
::
diff --git a/doc/usage/cmd/trace.rst b/doc/usage/cmd/trace.rst
index ad6db123942..e798b2bbc6b 100644
--- a/doc/usage/cmd/trace.rst
+++ b/doc/usage/cmd/trace.rst
@@ -6,8 +6,8 @@
trace command
=============
-Synopis
--------
+Synopsis
+--------
::
diff --git a/doc/usage/cmd/ut.rst b/doc/usage/cmd/ut.rst
index ddc48ec42dd..45bc9ffbdc5 100644
--- a/doc/usage/cmd/ut.rst
+++ b/doc/usage/cmd/ut.rst
@@ -6,8 +6,8 @@
ut command
==========
-Synopis
--------
+Synopsis
+--------
::