diff --git a/Documentation/NuttShell.html b/Documentation/NuttShell.html
index dbdf99614b..98fd6d460d 100644
--- a/Documentation/NuttShell.html
+++ b/Documentation/NuttShell.html
@@ -8,7 +8,7 @@
NuttShell (NSH)
- Last Updated: September 30, 2018
+ Last Updated: October 1, 2018
|
@@ -209,313 +209,319 @@
|
- 2.21 Show Memory Manager Status (free)
+ 2.21 Set an Environment Variable (export)
|
|
- 2.22 Get File Via TFTP (get)
+ 2.22 Show Memory Manager Status (free)
|
|
- 2.23 Show Usage Command Usage (help)
+ 2.23 Get File Via TFTP (get)
|
|
- 2.24 Hexadecimal Dump of File or Device (hexdump)
+ 2.24 Show Usage Command Usage (help)
|
|
- 2.25 Manage Network Configuration (ifconfig)
+ 2.25 Hexadecimal Dump of File or Device (hexdump)
|
|
- 2.26 Take a network down (ifdown)
+ 2.26 Manage Network Configuration (ifconfig)
|
|
- 2.27 Bring a network up (ifup)
+ 2.27 Take a network down (ifdown)
|
|
- 2.28 Install an OS module (insmod)
+ 2.28 Bring a network up (ifup)
|
|
- 2.29 Show Interrupt Status (irqinfo)
+ 2.29 Install an OS module (insmod)
|
|
- 2.30 Send a signal to a task (kill)
+ 2.30 Show Interrupt Status (irqinfo)
|
|
- 2.31 Setup/teardown the Loop Device (losetup)
+ 2.31 Send a signal to a task (kill)
|
|
- 2.32 List to a File or Directory (ln)
+ 2.32 Setup/teardown the Loop Device (losetup)
|
|
- 2.33 List Directory Contents (ls)
+ 2.33 List to a File or Directory (ln)
|
|
- 2.34 Show information about installed OS modules (lsmod)
+ 2.34 List Directory Contents (ls)
|
|
- 2.35 Calculate MD5 (md5)
+ 2.35 Show information about installed OS modules (lsmod)
|
|
- 2.36 Access Memory (mb, mh, and mw)
+ 2.36 Calculate MD5 (md5)
|
|
- 2.37 Show Current Tasks and Threads (ps)
+ 2.37 Access Memory (mb, mh, and mw)
|
|
- 2.38 Create a Directory (mkdir)
+ 2.38 Show Current Tasks and Threads (ps)
|
|
- 2.39 Create a FAT File System (mkfatfs)
+ 2.39 Create a Directory (mkdir)
|
|
- 2.40 Create a FIFO (mkfifo)
+ 2.40 Create a FAT File System (mkfatfs)
|
|
- 2.41 Create a RAMDISK (mkrd)
+ 2.41 Create a FIFO (mkfifo)
|
|
- 2.42 Mount a File System (mount)
+ 2.42 Create a RAMDISK (mkrd)
|
|
- 2.43 Rename a File (mv)
+ 2.43 Mount a File System (mount)
|
|
- 2.44 Mount an NFS File System (nfsmount)
+ 2.44 Rename a File (mv)
|
|
- 2.45 Lookup a network address (nslookup)
+ 2.45 Mount an NFS File System (nfsmount)
|
|
- 2.46 Change a User's Password (passwd)
+ 2.46 Lookup a network address (nslookup)
|
|
- 2.47 Shut the system down (poweroff)
+ 2.47 Change a User's Password (passwd)
|
|
- 2.48 Send File Via TFTP (put)
+ 2.48 Shut the system down (poweroff)
|
|
- 2.49 Show Current Working Directory (pwd)
+ 2.49 Send File Via TFTP (put)
|
|
- 2.50 Show target of a link (readlink)
+ 2.50 Show Current Working Directory (pwd)
|
|
- 2.51 Reset and reboot the system (reboot)
+ 2.51 Show target of a link (readlink)
|
|
- 2.52 Remove a File (rm)
+ 2.52 Reset and reboot the system (reboot)
|
|
- 2.53 Remove a Directory (rmdir)
+ 2.53 Remove a File (rm)
|
|
- 2.54 Remove on OS Module (rmmod)
+ 2.54 Remove a Directory (rmdir)
|
|
- 2.55 Show routing table (route)
+ 2.55 Remove on OS Module (rmmod)
|
|
- 2.56 Set an Environment Variable (set)
+ 2.56 Show routing table (route)
|
|
- 2.57 Execute an NSH Script (sh)
+ 2.57 Set a Variable (set)
|
|
- 2.58 Shut the system down (shutdown)
+ 2.58 Execute an NSH Script (sh)
|
|
- 2.59 Wait for Seconds (sleep)
+ 2.59 Shut the system down (shutdown)
|
|
- 2.60 Start the Telnet Daemon (telnetd)
+ 2.60 Wait for Seconds (sleep)
|
|
- 2.61 Time execution of another command (time)
+ 2.61 Start the Telnet Daemon (telnetd)
|
|
- 2.62 Set the Size of a File (truncate)
+ 2.62 Time execution of another command (time)
|
|
- 2.63 Unmount a File System (umount)
+ 2.63 Set the Size of a File (truncate)
|
|
- 2.64 Print system information (uname)
+ 2.64 Unmount a File System (umount)
|
|
- 2.65 Unset an Environment Variable (unset)
+ 2.65 Print system information (uname)
|
|
- 2.66 URL Decode (urldecode)
+ 2.66 Unset an Environment Variable (unset)
|
|
- 2.67 URL Encode (urlencode)
+ 2.67 URL Decode (urldecode)
|
|
- 2.68 Add a New User (useradd)
+ 2.68 URL Encode (urlencode)
|
|
- 2.69 Delete a user (userdel)
+ 2.69 Add a New User (useradd)
|
|
- 2.70 Wait for Microseconds (usleep)
+ 2.70 Delete a user (userdel)
|
|
- 2.71 Get File Via HTTP (wget)
+ 2.71 Wait for Microseconds (usleep)
|
|
- 2.72 Hexadecimal Dump of Memory (xd)
+ 2.72 Get File Via HTTP (wget)
+ |
+
+
+
|
+
+ 2.73 Hexadecimal Dump of Memory (xd)
|
@@ -1664,7 +1670,7 @@ env
Synopsis.
- Show the current address environment. Example:.
+ Show the current name-value pairs in the environment. Example:.
nsh> env
@@ -1681,6 +1687,9 @@ foo=bar
nsh>
+
+ NOTE: NSH local variables are not shown by the env
command.
+
@@ -1723,7 +1732,59 @@ exit
+
+Command Syntax:
+
+export <name> [<value>]
+
+
+ Synopsis.
+ The export
command sets an environment variable, or promotes an NSH variable to an environment variable. As examples:
+
+
+ -
+
+ Using export
to promote an NSH variable to an environment variable.
+
+
+nsh> env
+PATH=/bin
+
+nsh> set foo bar
+nsh> env
+PATH=/bin
+
+nsh> export foo
+nsh> env
+PATH=/bin
+foo=bar
+
+
+ -
+
+ Using export
to set an environment variable
+
+
+nsh> export dog poop
+nsh> env
+PATH=/bin
+foo=bar
+dog=poop
+
+
+
+
+ The export
command is not supported by NSH unless both CONFIG_NSH_VARS=y
and CONFIG_DISABLE_ENVIRON
is not set.
+
+
+
@@ -1765,7 +1826,7 @@ nsh>
@@ -1800,7 +1861,7 @@ get [-b|-n] [-f <local-path>] -h <ip-address> <remote-path>
@@ -1832,7 +1893,7 @@ help [-v] [<cmd>]
@@ -1862,7 +1923,7 @@ The skip
and count
options are only available if
- 2.25 Manage Network Configuration (ifconfig)
+ 2.26 Manage Network Configuration (ifconfig)
|
@@ -1924,7 +1985,7 @@ nsh> mount -t procfs /proc
@@ -1947,7 +2008,7 @@ ifdown eth0
@@ -1970,7 +2031,7 @@ ifup eth0
@@ -2013,7 +2074,7 @@ mydriver 20404659 20404625 0 20404580 552 204047a8 0
@@ -2040,7 +2101,7 @@ IRQ HANDLER ARGUMENT COUNT RATE
@@ -2087,7 +2148,7 @@ nsh>
@@ -2140,7 +2201,7 @@ losetup d <dev-path>
@@ -2165,7 +2226,7 @@ ln [-s] <target> <link>
@@ -2203,7 +2264,7 @@ ls [-lRs] <dir-path>
@@ -2236,7 +2297,7 @@ mydriver 20404659 20404625 0 20404580 552 204047a8 0
@@ -2253,7 +2314,7 @@ md5 [-f] <string or filepath>
@@ -2306,7 +2367,7 @@ nsh>
@@ -2340,7 +2401,7 @@ nsh> mount -t procfs /proc
@@ -2375,7 +2436,7 @@ nsh>
@@ -2407,7 +2468,7 @@ mkfatfs [-F <fatsize>] [-r <rootdirentries>] <block-driver>
@@ -2445,7 +2506,7 @@ nsh>
@@ -2496,7 +2557,7 @@ nsh>
@@ -2575,7 +2636,7 @@ nsh> mount
@@ -2593,7 +2654,7 @@ mv <old-path> <new-path>
@@ -2612,7 +2673,7 @@ nfsmount <server-address> <mount-point> <remote-path>
@@ -2629,7 +2690,7 @@ nslookup <host-name>
@@ -2646,7 +2707,7 @@ passwd <username> <password>
@@ -2670,7 +2731,7 @@ poweroff [<n>]
@@ -2705,7 +2766,7 @@ put [-b|-n] [-f <remote-path>] -h <ip-address> <local-path>
@@ -2735,7 +2796,7 @@ nsh>
@@ -2752,7 +2813,7 @@ readlink <link>
@@ -2774,7 +2835,7 @@ reboot [<n>]
@@ -2808,7 +2869,7 @@ nsh>
@@ -2843,7 +2904,7 @@ nsh>
@@ -2871,7 +2932,7 @@ nsh>
@@ -2891,7 +2952,7 @@ route ipv4|ipv6
@@ -2902,7 +2963,10 @@ set [{+|-}{e|x|xe|ex}] [<name> <value>]
Synopsis.
- Set the environment variable <name>
to the string <value>
and or set NSH parser control options. For example,
+ Set the variable <name>
to the string <value>
and or set NSH parser control options.
+
+
+ For example, a variable may be set like this:
nsh> echo $foobar
@@ -2912,7 +2976,9 @@ nsh> echo $foobar
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.
+
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
@@ -2960,7 +3026,7 @@ nsh>
@@ -2978,7 +3044,7 @@ sh <script-path>
@@ -2999,7 +3065,7 @@ shutdown [--reboot]
@@ -3016,7 +3082,7 @@ sleep <sec>
@@ -3042,7 +3108,7 @@ telnetd
@@ -3100,7 +3166,7 @@ nsh>
@@ -3128,7 +3194,7 @@ truncate -s <length> <file-path>
@@ -3158,7 +3224,7 @@ nsh>
@@ -3225,7 +3291,7 @@ uname [-a | -imnoprsv]
@@ -3236,8 +3302,8 @@ unset <name>
Synopsis.
- Remove the value associated with the environment variable
- <name>
. Example:
+ Remove the value associated with the variable <name>
.
+ This will remove the name-value pair from both the NSH local variables and the group-wide environment variables. For example:
nsh> echo $foobar
@@ -3251,7 +3317,7 @@ nsh>
@@ -3268,7 +3334,7 @@ urldecode [-f] <string or filepath>
@@ -3285,7 +3351,7 @@ urlencode [-f] <string or filepath>
@@ -3302,7 +3368,7 @@ useradd <username> <password>
@@ -3319,7 +3385,7 @@ userdel <username>
@@ -3336,7 +3402,7 @@ usleep <usec>
@@ -3363,7 +3429,7 @@ wget [-o <local-path>] <url>
@@ -3571,7 +3637,7 @@ nsh>
env |
- CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_PROCFS && !CONFIG_DISABLE_ENVIRON && !CONFIG_PROCFS_EXCLUDE_ENVIRON
+ | CONFIG_NFILE_DESCRIPTORS > 0 && CONFIG_FS_PROCFS && !CONFIG_DISABLE_ENVIRON && !CONFIG_PROCFS_EXCLUDE_ENVIRON
| CONFIG_NSH_DISABLE_ENV |
@@ -3584,6 +3650,11 @@ nsh>
|
CONFIG_NSH_DISABLE_EXIT |
+
+ export |
+ CONFIG_NSH_VARS && !CONFIG_DISABLE_ENVIRON |
+ CONFIG_NSH_DISABLE_EXPORT |
+
free |
|
@@ -3767,7 +3838,7 @@ nsh>
set |
- !CONFIG_DISABLE_ENVIRON |
+ CONFIG_NSH_VARS || !CONFIG_DISABLE_ENVIRON |
CONFIG_NSH_DISABLE_SET |
@@ -3817,7 +3888,7 @@ nsh>
unset |
- !CONFIG_DISABLE_ENVIRON |
+ CONFIG_NSH_VARS || !CONFIG_DISABLE_ENVIRON |
CONFIG_NSH_DISABLE_UNSET |
@@ -4020,6 +4091,57 @@ set FOOBAR ABC_${FOO}_${BAR}
If CONFIG_NSH_ARGCAT
is not selected, then a slightly small FLASH footprint results but then also only simple environment variables like $FOO
can be used on the command line.
+
+ CONFIG_NSH_VARS |
+
+ By default, there are no internal NSH variables. NSH will use OS
+ environment variables for all variable storage. If this option, NSH
+ will also support local NSH variables. These variables are, for the
+ most part, transparent and work just like the OS environment
+ variables. The difference is that when you create new tasks, all of
+ environment variables are inherited by the created tasks. NSH local
+ variables are not.
+
+
+ If this option is enabled (and CONFIG_DISABLE_ENVIRON is not), then a
+ new command called 'export' is enabled. The export command works very
+ must like the set command except that is operates on environment
+ variables. When CONFIG_NSH_VARS is enabled, there are changes in the
+ behavior of certain commands
+
+
+
+ CMD |
+ w/o CONFIG_NSH_VARS |
+ w/ CONFIG_NSH_VARS |
+
+
+ set <a> <b> |
+ Set environment variable <a> to <b> |
+ Set NSH variable <a> to <b> |
+
+
+ unset <a> |
+ Unsets environment variable <a> |
+ Unsets both environment variable and NSH variable <a> |
+
+
+ export <a> <b> |
+ Causes an error, |
+ Unsets NSH variable <a>. Sets environment variable <a> to <b>. |
+
+
+ export <a> |
+ Causes an error. |
+ Sets environment variable <a> to the value of NSH variable <a> (or "" if undefined). Unsets NSH local variable <a>. |
+
+
+ env |
+ Lists all environment variables |
+ Lists all environment variables (only) |
+
+
+ |
CONFIG_NSH_QUOTE |
@@ -5530,7 +5652,7 @@ xxd -i romfs_img >nsh_romfsimg.h
- There is a good example of how to do this in the NSH simulation configuration at configs/sim/nsh. The ROMFS support files are provided at configs/sim/include and the README.txt file at the location provides detailed information about creating and modifying the ROMFS file system.
+ There is a good example of how to do this in the NSH simulation configuration at configs/sim/nsh. The ROMFS support files are provided at configs/sim/include and the README.txt file at the location provides detailed information about creating and modifying the ROMFS file system.
|