Documentation/NuttShell.html: Document recent changes to NSH.
This commit is contained in:
parent
17c18a1347
commit
5d791547dd
@ -8,7 +8,7 @@
|
|||||||
<tr align="center" bgcolor="#e4e4e4">
|
<tr align="center" bgcolor="#e4e4e4">
|
||||||
<td>
|
<td>
|
||||||
<h1><big><font color="#3c34ec"><i>NuttShell (NSH)</i></font></big></h1>
|
<h1><big><font color="#3c34ec"><i>NuttShell (NSH)</i></font></big></h1>
|
||||||
<p>Last Updated: June 22, 2018</p>
|
<p>Last Updated: August 11, 2018</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@ -846,28 +846,44 @@ nsh>
|
|||||||
</p>
|
</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<b><code>CONFIG_NSH_CMDPARMS</code></b>.
|
<p>
|
||||||
If selected, then the output from commands, from file applications, and from NSH built-in commands can be used as arguments to other commands.
|
<b><code>CONFIG_NSH_CMDPARMS</code></b>.
|
||||||
The entity to be executed is identified by enclosing the command line in back quotes.
|
If selected, then the output from commands, from file applications, and from NSH built-in commands can be used as arguments to other commands.
|
||||||
|
The entity to be executed is identified by enclosing the command line in back quotes.
|
||||||
For example,
|
For example,
|
||||||
<p>
|
</p>
|
||||||
<ul><pre>
|
<ul><pre>
|
||||||
set FOO `myprogram $BAR`
|
set FOO `myprogram $BAR`
|
||||||
</pre></ul>
|
</pre></ul>
|
||||||
<p>
|
<p>
|
||||||
Will execute the program named <code>myprogram</code> passing it the value of the environment variable <code>BAR</code>.
|
Will execute the program named <code>myprogram</code> passing it the value of the environment variable <code>BAR</code>.
|
||||||
The value of the environment variable <code>FOO</code> is then set output of <code>myprogram</code> on <code>stdout</code>.
|
The value of the environment variable <code>FOO</code> is then set output of <code>myprogram</code> on <code>stdout</code>.
|
||||||
|
</p>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<b><code>CONFIG_NSH_ARGCAT</code></b>.
|
<p>
|
||||||
Support concatenation of strings with environment variables or command output. For example:
|
<b><code>CONFIG_NSH_ARGCAT</code></b>.
|
||||||
|
Support concatenation of strings with environment variables or command output. For example:
|
||||||
|
</p>
|
||||||
<ul><pre>
|
<ul><pre>
|
||||||
set FOO XYZ
|
set FOO XYZ
|
||||||
set BAR 123
|
set BAR 123
|
||||||
set FOOBAR ABC_${FOO}_${BAR}
|
set FOOBAR ABC_${FOO}_${BAR}
|
||||||
</pre></ul>
|
</pre></ul>
|
||||||
would set the environment variable <code>FOO</code> to <code>XYZ</code>, <code>BAR</code> to <code>123</code> and <code>FOOBAR</code> to <code>ABC_XYZ_123</code>.
|
<p>
|
||||||
If <code>CONFIG_NSH_ARGCAT</code> is not selected, then a slightly smaller FLASH footprint results but then also only simple environment variables like <code>$FOO</code> can be used on the command line.
|
would set the environment variable <code>FOO</code> to <code>XYZ</code>, <code>BAR</code> to <code>123</code> and <code>FOOBAR</code> to <code>ABC_XYZ_123</code>.
|
||||||
|
If <code>CONFIG_NSH_ARGCAT</code> is not selected, then a slightly smaller FLASH footprint results but then also only simple environment variables like <code>$FOO</code> can be used on the command line.
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<p>
|
||||||
|
<b><code>CONFIG_NSH_QUOTE</code></b>.
|
||||||
|
Enables back-slash quoting of certain characters within the command.
|
||||||
|
This option is useful for the case where an NSH script is used to dynamically generate a new NSH script.
|
||||||
|
In that case, commands must be treated as simple text strings without interpretation of any special characters.
|
||||||
|
Special characters such as <code>$</code>, <code>`</code>, <code>"</code>, and others must be retained intact as part of the test string.
|
||||||
|
This option is currently only available is <code>CONFIG_NSH_ARGCAT</code> is also selected.
|
||||||
|
</p>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
@ -886,7 +902,7 @@ set FOOBAR ABC_${FOO}_${BAR}
|
|||||||
(see the <a href="#cmdsh"><code>sh</code></a> command). The syntax is as follows:
|
(see the <a href="#cmdsh"><code>sh</code></a> command). The syntax is as follows:
|
||||||
</p>
|
</p>
|
||||||
<ul><pre>
|
<ul><pre>
|
||||||
if <cmd>
|
if [!] <cmd>
|
||||||
then
|
then
|
||||||
[sequence of <cmd>]
|
[sequence of <cmd>]
|
||||||
else
|
else
|
||||||
@ -910,10 +926,10 @@ fi
|
|||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
<p><b><code>while-do-done</code></b>.
|
<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.
|
Execute <code>[sequence of <cmd>]</code> as long as <code><cmd></code> has an exit status of zero (or non-zero if inverted with <code>!</code>).
|
||||||
The syntax is as follows:
|
The syntax is as follows:
|
||||||
<ul><pre>
|
<ul><pre>
|
||||||
while <cmd>
|
while [!] <cmd>
|
||||||
do
|
do
|
||||||
[sequence of <cmd>]
|
[sequence of <cmd>]
|
||||||
done
|
done
|
||||||
@ -922,10 +938,10 @@ done
|
|||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<p><b><code>until-do-done</code></b>
|
<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.
|
Execute <code>[sequence of <cmd>]</code> as long as <code><cmd></code> has a non-zero exit status (or zero if inverted with <code>!</code>).
|
||||||
The syntax is as follows:
|
The syntax is as follows:
|
||||||
<ul><pre>
|
<ul><pre>
|
||||||
until <cmd>
|
until [!] <cmd>
|
||||||
do
|
do
|
||||||
[sequence of <cmd>]
|
[sequence of <cmd>]
|
||||||
done
|
done
|
||||||
@ -934,6 +950,10 @@ done
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Note that <code>while</code> is equivalent to <code>until</code> if the command result is inverted.
|
||||||
|
</p>
|
||||||
|
|
||||||
<p><b>The <a href="#cmdbreak"><code>break</code></a> Command</b>.
|
<p><b>The <a href="#cmdbreak"><code>break</code></a> Command</b>.
|
||||||
A <a href="#cmdbreak"><code>break</code></a> command is also supported.
|
A <a href="#cmdbreak"><code>break</code></a> command is also supported.
|
||||||
The <code>break</code> command is only meaningful within the body of the a while or until loop, between the <code>do</code> and <code>done</code> tokens.
|
The <code>break</code> command is only meaningful within the body of the a while or until loop, between the <code>do</code> and <code>done</code> tokens.
|
||||||
@ -3941,6 +3961,16 @@ set FOOBAR ABC_${FOO}_${BAR}
|
|||||||
If <code>CONFIG_NSH_ARGCAT</code> is not selected, then a slightly small FLASH footprint results but then also only simple environment variables like <code>$FOO</code> can be used on the command line.
|
If <code>CONFIG_NSH_ARGCAT</code> is not selected, then a slightly small FLASH footprint results but then also only simple environment variables like <code>$FOO</code> can be used on the command line.
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td valign="top"><b><code>CONFIG_NSH_QUOTE</code></b></td>
|
||||||
|
<td>
|
||||||
|
Enables back-slash quoting of certain characters within the command.
|
||||||
|
This option is useful for the case where an NSH script is used to dynamically generate a new NSH script.
|
||||||
|
In that case, commands must be treated as simple text strings without interpretation of any special characters.
|
||||||
|
Special characters such as <code>$</code>, <code>`</code>, <code>"</code>, and others must be retained intact as part of the test string.
|
||||||
|
This option is currently only available is <code>CONFIG_NSH_ARGCAT</code> is also selected.
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td valign="top"><b><code>CONFIG_NSH_NESTDEPTH</code></b></td>
|
<td valign="top"><b><code>CONFIG_NSH_NESTDEPTH</code></b></td>
|
||||||
<td>
|
<td>
|
||||||
@ -5488,6 +5518,7 @@ xxd -i romfs_img >nsh_romfsimg.h
|
|||||||
<li><a href="#custinit"><code>CONFIG_NFILE_DESCRIPTORS</code></a></li>
|
<li><a href="#custinit"><code>CONFIG_NFILE_DESCRIPTORS</code></a></li>
|
||||||
<li><a href="#nshconfiguration"><code>CONFIG_NSH_ARCHINIT</code></a></li>
|
<li><a href="#nshconfiguration"><code>CONFIG_NSH_ARCHINIT</code></a></li>
|
||||||
<li><a href="#custinit"><code>CONFIG_NSH_ARCHROMFS</code></a></li>
|
<li><a href="#custinit"><code>CONFIG_NSH_ARCHROMFS</code></a></li>
|
||||||
|
<li><a href="#nshconfiguration"><code>CONFIG_NSH_ARCHROMFS</code></a></li>
|
||||||
<li><a href="#nshconfiguration"><code>CONFIG_NSH_ARGCAT</code></a></li>
|
<li><a href="#nshconfiguration"><code>CONFIG_NSH_ARGCAT</code></a></li>
|
||||||
<li><a href="#nshconfiguration"><code>CONFIG_NSH_BUILTIN_APPS</code></a></li>
|
<li><a href="#nshconfiguration"><code>CONFIG_NSH_BUILTIN_APPS</code></a></li>
|
||||||
<li><a href="#custapps"><code>CONFIG_NSH_BUILTIN_APPS</code></a></li>
|
<li><a href="#custapps"><code>CONFIG_NSH_BUILTIN_APPS</code></a></li>
|
||||||
@ -5514,11 +5545,11 @@ xxd -i romfs_img >nsh_romfsimg.h
|
|||||||
<li><a href="#nshconfiguration"><code>CONFIG_NSH_NESTDEPTH</code></a></li>
|
<li><a href="#nshconfiguration"><code>CONFIG_NSH_NESTDEPTH</code></a></li>
|
||||||
<li><a href="#nshconfiguration"><code>CONFIG_NSH_NETMASK</code></a></li>
|
<li><a href="#nshconfiguration"><code>CONFIG_NSH_NETMASK</code></a></li>
|
||||||
<li><a href="#nshconfiguration"><code>CONFIG_NSH_NOMAC</code></a></li>
|
<li><a href="#nshconfiguration"><code>CONFIG_NSH_NOMAC</code></a></li>
|
||||||
|
<li><a href="#nshconfiguration"><code>CONFIG_NSH_QUOTE</code></a></li>
|
||||||
<li><a href="#nshconfiguration"><code>CONFIG_NSH_READLINE</code></a></li>
|
<li><a href="#nshconfiguration"><code>CONFIG_NSH_READLINE</code></a></li>
|
||||||
<li><a href="#nshconfiguration"><code>CONFIG_NSH_ROMFSDEVNO</code></a></li>
|
<li><a href="#nshconfiguration"><code>CONFIG_NSH_ROMFSDEVNO</code></a></li>
|
||||||
<li><a href="#nshconfiguration"><code>CONFIG_NSH_ROMFSETC</code></a></li>
|
<li><a href="#nshconfiguration"><code>CONFIG_NSH_ROMFSETC</code></a></li>
|
||||||
<li><a href="#custinit"><code>CONFIG_NSH_ROMFSETC</code></a></li>
|
<li><a href="#custinit"><code>CONFIG_NSH_ROMFSETC</code></a></li>
|
||||||
<li><a href="#nshconfiguration"><code>CONFIG_NSH_ARCHROMFS</code></a></li>
|
|
||||||
<li><a href="#nshconfiguration"><code>CONFIG_NSH_ROMFSMOUNTPT</code></a></li>
|
<li><a href="#nshconfiguration"><code>CONFIG_NSH_ROMFSMOUNTPT</code></a></li>
|
||||||
<li><a href="#nshconfiguration"><code>CONFIG_NSH_ROMFSSECTSIZE</code></a></li>
|
<li><a href="#nshconfiguration"><code>CONFIG_NSH_ROMFSSECTSIZE</code></a></li>
|
||||||
<li><a href="#nshconfiguration"><code>CONFIG_NSH_STRERROR</code></a></li>
|
<li><a href="#nshconfiguration"><code>CONFIG_NSH_STRERROR</code></a></li>
|
||||||
@ -5593,10 +5624,10 @@ xxd -i romfs_img >nsh_romfsimg.h
|
|||||||
<li><a href="#cmdoverview"><code>nice</code></a></li>
|
<li><a href="#cmdoverview"><code>nice</code></a></li>
|
||||||
<li><a href="#nshlibrary">NSH library (<code>nshlib</code>)</a></li>
|
<li><a href="#nshlibrary">NSH library (<code>nshlib</code>)</a></li>
|
||||||
<li><a href="#custonshlib">NSH library (<code>nshlib</code>), initialization</a></li>
|
<li><a href="#custonshlib">NSH library (<code>nshlib</code>), initialization</a></li>
|
||||||
|
<li><a href="#custonshlib"><code>nsh_consolemain()</code></a></li>
|
||||||
</ul></td>
|
</ul></td>
|
||||||
<td width="34%" valign="top">
|
<td width="34%" valign="top">
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="#custonshlib"><code>nsh_consolemain()</code></a></li>
|
|
||||||
<li><a href="#custonshlib"><code>nsh_initialize()</code></a></li>
|
<li><a href="#custonshlib"><code>nsh_initialize()</code></a></li>
|
||||||
<li><a href="#custonshlib"><code>nsh_main()</code></a></li>
|
<li><a href="#custonshlib"><code>nsh_main()</code></a></li>
|
||||||
<li><a href="#custinit"><code>nsh_main.c</code></a></li>
|
<li><a href="#custinit"><code>nsh_main.c</code></a></li>
|
||||||
|
Loading…
Reference in New Issue
Block a user