From 0de787b558adfb5be454fb038fbc3838bfe2df2b Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Wed, 5 Apr 2017 18:28:54 -0600 Subject: [PATCH] Document set [{+|-}{e|x|xe|ex}] [ ] --- Documentation/NuttShell.html | 53 ++++++++++++++++++++++++++++++++++-- 1 file changed, 50 insertions(+), 3 deletions(-) diff --git a/Documentation/NuttShell.html b/Documentation/NuttShell.html index 987f8a7177..af8eeba20b 100644 --- a/Documentation/NuttShell.html +++ b/Documentation/NuttShell.html @@ -8,7 +8,7 @@

NuttShell (NSH)

-

Last Updated: February 5, 2017

+

Last Updated: April 5, 2017

@@ -2708,11 +2708,13 @@ nsh>

Command Syntax:

    -set <name> <value>
    +set [{+|-}{e|x|xe|ex}] [<name> <value>]
     

Synopsis. - Set the environment variable <name> to the string <value>. + Set the environment variable <name> to the string <value> and or set NSH + parser control options. For example, + For example,

    @@ -2724,6 +2726,51 @@ foovalue
     nsh>
     
+

+ 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. +

+

+ 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. +

+

+ 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. + +

+ + Example 1 - no exit on command not found +
    +    set +e
    +    notacommand
    +
+ + Example 2 - will exit on command not found +
    +    set -e
    +    notacommand
    +
+ + Example 3 - will exit on command not found, and print a trace of the script commmands +
    +    set -ex
    +
+ + Example 4 - will exit on command not found, and print a trace of the script commmands + and set foobar to foovalue. +
    +    set -ex foobar foovalue
    +    nsh> echo $foobar
    +    foovalue
    +
+ +