diff options
author | Gregory Nutt <gnutt@nuttx.org> | 2014-01-17 18:03:23 -0600 |
---|---|---|
committer | Gregory Nutt <gnutt@nuttx.org> | 2014-01-17 18:03:23 -0600 |
commit | 4f8b0d0a714a7f8302e876e217e8f49e2c5901d5 (patch) | |
tree | 15d6fa10198715c62050711a064cce6444d064e1 /nuttx | |
parent | e33bd6bd784ba0334beb0481d82416be38fbb54d (diff) | |
download | px4-nuttx-4f8b0d0a714a7f8302e876e217e8f49e2c5901d5.tar.gz px4-nuttx-4f8b0d0a714a7f8302e876e217e8f49e2c5901d5.tar.bz2 px4-nuttx-4f8b0d0a714a7f8302e876e217e8f49e2c5901d5.zip |
NSH: Loosen up if-then-else-fi syntx so that a command can be on the same line as the 'then' and 'else' tokens. This allows, as an example, 'if true; then echo true; else echo false; fi' which is much more bash-like
Diffstat (limited to 'nuttx')
-rw-r--r-- | nuttx/Documentation/NuttShell.html | 33 |
1 files changed, 26 insertions, 7 deletions
diff --git a/nuttx/Documentation/NuttShell.html b/nuttx/Documentation/NuttShell.html index 603ae759d..2eeed4e67 100644 --- a/nuttx/Documentation/NuttShell.html +++ b/nuttx/Documentation/NuttShell.html @@ -618,15 +618,34 @@ fi <p> <code>while-do-done</code> and <code>until-do-done</code> looping constructs are also supported. - These works from the command line but are primarily intended for use within NSH scripts + These work from the command line but are primarily intended for use within NSH scripts (see the <a href="#cmdsh"><code>sh</code></a> command). - The syntax is as follows: </p> -<ul><dl> - <dt><code>while <test-cmd>; do <cmd-sequence>; done</code></dt> - <dd>Execute <code><cmd-sequence></code> as long as <code><test-cmd></code> has an exit status of zero.</dd> - <dt><code>until <test-cmd>; do <cmd-sequence>; done</code></dt> - <dd>Execute <code><cmd-sequence></code> as long as <code><test-cmd></code> has a non-zero exit status.</dd> +<ul> + <li> + <p><b><code>while-do-done</code></b>. + Execute <code>[sequence of <cmd>]</code> as long as <code><cmd></code> has an exit status of zero. + The syntax is as follows: + <ul><pre> +while <cmd> +do + [sequence of <cmd>] +done +</pre></ul> + </p> + </li> + <li> + <p><b><code>until-do-done</code></b> + Execute <code>[sequence of <cmd>]</code> as long as <code><cmd></code> has a non-zero exit status. + The syntax is as follows: + <ul><pre> +while <cmd> +do + [sequence of <cmd>] +done +</pre></ul> + </p> + </li> </dl></ul> <table width ="100%"> |