From a90e031028dece53bcb37705cce2c14107718c77 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Tue, 2 Oct 2018 06:52:47 -0600 Subject: [PATCH] Documentation/NuttShell.html: Improve an explanation. --- Documentation/NuttShell.html | 74 ++++++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 29 deletions(-) diff --git a/Documentation/NuttShell.html b/Documentation/NuttShell.html index a328e6e6d2..771788deb8 100644 --- a/Documentation/NuttShell.html +++ b/Documentation/NuttShell.html @@ -8,7 +8,7 @@

NuttShell (NSH)

-

Last Updated: October 1, 2018

+

Last Updated: October 2, 2018

@@ -1766,6 +1766,13 @@ nsh> env PATH=/bin foo=bar +

+ A group-wide environment variable is created with the same value as the local NSH variable; the local NSH variable is removed. +

+
+ NOTE: This behavior differs from the Bash shell. + Bash would retain the local Bash variable which will shadow the environment variable of the same name. +
  • @@ -2980,52 +2987,61 @@ foovalue nsh>

    - If CONFIG_NSH_VARS is set, the effect of this set command is to set the local NSH variable. Otherwise, the group-wide environment variable will be set. + If CONFIG_NSH_VARS is selected, the effect of this set command is to set the local NSH variable. Otherwise, the group-wide environment variable will be set. +

    + If the local NSH variable has already been promoted to an environment variable via the export, then the set command will set the value of the environment variable rather than the local NSH variable.

    - Set the 'exit on error control' and/or 'print a trace' of commands when parsing - scripts in NSH. The settings are in effect from the point of execution, 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. +

    + NOTE: The Bash shell does not work this way. + Bash would set the value of the local Bash variable and would not modify the environment variable. + The local Bash variable would that then shadow the environment variable with a differing value. +

    - 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. + Set the exit on error control and/or print a trace of commands when parsing scripts in NSH. + The settings are in effect from the point of execution, until they are changed again, or in the case of the initialization 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 -x' to enable and 'set +x' to disable (silence) printing a trace of the script - commands as they are executed. - The default is +x: no printing of a trace of script commands as they are executed. -

    - Example 1 - no exit on command not found +

    - +

    Example 2 - will exit on command not found +

    - +

    Example 3 - will exit on command not found, and print a trace of the script commands +

    - - Example 4 - will exit on command not found, and print a trace of the script commands - and set foobar to foovalue. +

    + Example 4 - will exit on command not found, and print a trace of the script commands and set foobar to foovalue. +

    -