Document set [{+|-}{e|x|xe|ex}] [<name> <value>]
This commit is contained in:
parent
18518eae06
commit
0de787b558
@ -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: February 5, 2017</p>
|
<p>Last Updated: April 5, 2017</p>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
@ -2708,11 +2708,13 @@ nsh>
|
|||||||
|
|
||||||
<p><b>Command Syntax:</b></p>
|
<p><b>Command Syntax:</b></p>
|
||||||
<ul><pre>
|
<ul><pre>
|
||||||
set <name> <value>
|
set [{+|-}{e|x|xe|ex}] [<name> <value>]
|
||||||
</pre></ul>
|
</pre></ul>
|
||||||
<p>
|
<p>
|
||||||
<b>Synopsis</b>.
|
<b>Synopsis</b>.
|
||||||
Set the environment variable <code><name></code> to the string <code><value></code>.
|
Set the environment variable <code><name></code> to the string <code><value></code> and or set NSH
|
||||||
|
parser control options. For example,
|
||||||
|
|
||||||
For example,
|
For example,
|
||||||
</p>
|
</p>
|
||||||
<ul><pre>
|
<ul><pre>
|
||||||
@ -2724,6 +2726,51 @@ foovalue
|
|||||||
nsh>
|
nsh>
|
||||||
</pre></ul>
|
</pre></ul>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
Set the 'exit on error control' and/or 'print a trace' of commands when parsing
|
||||||
|
scripts in NSH. The settinngs are in effect from the point of exection, until
|
||||||
|
they are changed again, or in the case of the init script, the settings are
|
||||||
|
returned to the default settings when it exits. Included child scripts will run
|
||||||
|
with the parents settings and changes made in the child script will effect the
|
||||||
|
parent on return.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Use 'set -e' to enable and 'set +e' to disable (ignore) the exit condition on commands.
|
||||||
|
The default is -e. Errors cause script to exit.
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
Use 'set -x' to enable and 'set +x' to disable (silence) printing a trace of the script
|
||||||
|
commands as they are ececuted.
|
||||||
|
The default is +x. No printing of a trace of script commands as they are executed.
|
||||||
|
|
||||||
|
</p>
|
||||||
|
|
||||||
|
Example 1 - no exit on command not found
|
||||||
|
<ul><pre>
|
||||||
|
set +e
|
||||||
|
notacommand
|
||||||
|
</pre></ul>
|
||||||
|
|
||||||
|
Example 2 - will exit on command not found
|
||||||
|
<ul><pre>
|
||||||
|
set -e
|
||||||
|
notacommand
|
||||||
|
</pre></ul>
|
||||||
|
|
||||||
|
Example 3 - will exit on command not found, and print a trace of the script commmands
|
||||||
|
<ul><pre>
|
||||||
|
set -ex
|
||||||
|
</pre></ul>
|
||||||
|
|
||||||
|
Example 4 - will exit on command not found, and print a trace of the script commmands
|
||||||
|
and set foobar to foovalue.
|
||||||
|
<ul><pre>
|
||||||
|
set -ex foobar foovalue
|
||||||
|
nsh> echo $foobar
|
||||||
|
foovalue
|
||||||
|
</pre></ul>
|
||||||
|
|
||||||
|
|
||||||
<table width ="100%">
|
<table width ="100%">
|
||||||
<tr bgcolor="#e4e4e4">
|
<tr bgcolor="#e4e4e4">
|
||||||
<td>
|
<td>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user