From 1236d194ac1caf4a62ba22f2453cbb739b094bd1 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 1 Oct 2018 14:30:44 -0600 Subject: [PATCH] Documentation/NuttShell.html: Update document to describe the 'export' command, the CONFIG_NSH_VARS setting, and the effect of this setting on the behavior of the 'set' and 'unset' commands. --- Documentation/NuttShell.html | 353 +++++++++++++++++++++++------------ 1 file changed, 238 insertions(+), 115 deletions(-) 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:.

+

+ NOTE: NSH local variables are not shown by the env command. +

@@ -1723,7 +1732,59 @@ exit
+ +
-

2.21 Show Memory Manager Status (free)

+

2.21 Set an Environment Variable (export)

+
+ +

Command Syntax:

+ +

+ Synopsis. + The export command sets an environment variable, or promotes an NSH variable to an environment variable. As examples: +

+
    +
  1. +

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

    + Using export to set an environment variable +

    +
      +nsh> export dog poop
      +nsh> env
      +PATH=/bin
      +foo=bar
      +dog=poop
      +
    +
  4. +
+

+ The export command is not supported by NSH unless both CONFIG_NSH_VARS=y and CONFIG_DISABLE_ENVIRONis not set. +

+ + + +
+

2.22 Show Memory Manager Status (free)

@@ -1765,7 +1826,7 @@ nsh>
-

2.22 Get File Via TFTP (get)

+

2.23 Get File Via TFTP (get)

@@ -1800,7 +1861,7 @@ get [-b|-n] [-f <local-path>] -h <ip-address> <remote-path>
-

2.23 Show Usage Command Usage (help)

+

2.24 Show Usage Command Usage (help)

@@ -1832,7 +1893,7 @@ help [-v] [<cmd>]
-

2.24 Hexadecimal Dump of File or Device (hexdump)

+

2.25 Hexadecimal Dump of File or Device (hexdump)

@@ -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
-

2.26 Take a network down (ifdown)

+

2.27 Take a network down (ifdown)

@@ -1947,7 +2008,7 @@ ifdown eth0
-

2.27 Bring a network up (ifup)

+

2.28 Bring a network up (ifup)

@@ -1970,7 +2031,7 @@ ifup eth0
-

2.28 Install an OS module (insmod)

+

2.29 Install an OS module (insmod)

@@ -2013,7 +2074,7 @@ mydriver 20404659 20404625 0 20404580 552 204047a8 0
-

2.28 Show Interrupt Status (irqinfo)

+

2.30 Show Interrupt Status (irqinfo)

@@ -2040,7 +2101,7 @@ IRQ HANDLER ARGUMENT COUNT RATE
-

2.30 Send a signal to a task (kill)

+

2.31 Send a signal to a task (kill)

@@ -2087,7 +2148,7 @@ nsh>
-

2.31 Setup/teardown the Loop Device (losetup)

+

2.32 Setup/teardown the Loop Device (losetup)

@@ -2140,7 +2201,7 @@ losetup d <dev-path>
-

2.32 Link to a File or Directory (ln)

+

2.33 Link to a File or Directory (ln)

@@ -2165,7 +2226,7 @@ ln [-s] <target> <link>
-

2.33 List Directory Contents (ls)

+

2.34 List Directory Contents (ls)

@@ -2203,7 +2264,7 @@ ls [-lRs] <dir-path>
-

2.34 Show information about installed OS modules (lsmod)

+

2.35 Show information about installed OS modules (lsmod)

@@ -2236,7 +2297,7 @@ mydriver 20404659 20404625 0 20404580 552 204047a8 0
-

2.35 Calculate MD5 (md5)

+

2.36 Calculate MD5 (md5)

@@ -2253,7 +2314,7 @@ md5 [-f] <string or filepath>
-

2.36 Access Memory (mb, mh, and mw)

+

2.37 Access Memory (mb, mh, and mw)

@@ -2306,7 +2367,7 @@ nsh>
-

2.37 Show Current Tasks and Threads (ps)

+

2.38 Show Current Tasks and Threads (ps)

@@ -2340,7 +2401,7 @@ nsh> mount -t procfs /proc
-

2.38 Create a Directory (mkdir)

+

2.39 Create a Directory (mkdir)

@@ -2375,7 +2436,7 @@ nsh>
-

2.39 Create a FAT File System (mkfatfs)

+

2.40 Create a FAT File System (mkfatfs)

@@ -2407,7 +2468,7 @@ mkfatfs [-F <fatsize>] [-r <rootdirentries>] <block-driver>
-

2.40 Create a FIFO (mkfifo)

+

2.41 Create a FIFO (mkfifo)

@@ -2445,7 +2506,7 @@ nsh>
-

2.41 Create a RAMDISK (mkrd)

+

2.42 Create a RAMDISK (mkrd)

@@ -2496,7 +2557,7 @@ nsh>
-

2.42 Mount a File System (mount)

+

2.43 Mount a File System (mount)

@@ -2575,7 +2636,7 @@ nsh> mount
-

2.43 Rename a File (mv)

+

2.44 Rename a File (mv)

@@ -2593,7 +2654,7 @@ mv <old-path> <new-path>
-

2.44 Mount an NFS file system (nfsmount)

+

2.45 Mount an NFS file system (nfsmount)

@@ -2612,7 +2673,7 @@ nfsmount <server-address> <mount-point> <remote-path>
-

2.45 Lookup a network address (nslookup)

+

2.46 Lookup a network address (nslookup)

@@ -2629,7 +2690,7 @@ nslookup <host-name>
-

2.46 Change a User's Password (passwd)

+

2.47 Change a User's Password (passwd)

@@ -2646,7 +2707,7 @@ passwd <username> <password>
-

2.47 Shut the system down (poweroff)

+

2.48 Shut the system down (poweroff)

@@ -2670,7 +2731,7 @@ poweroff [<n>]
-

2.48 Send File Via TFTP (put)

+

2.49 Send File Via TFTP (put)

@@ -2705,7 +2766,7 @@ put [-b|-n] [-f <remote-path>] -h <ip-address> <local-path>
-

2.49 Show Current Working Directory (pwd)

+

2.50 Show Current Working Directory (pwd)

@@ -2735,7 +2796,7 @@ nsh>
-

2.50 Show target of a link (readlink)

+

2.51 Show target of a link (readlink)

@@ -2752,7 +2813,7 @@ readlink <link>
-

2.51 Reboot the system (reboot)

+

2.52 Reboot the system (reboot)

@@ -2774,7 +2835,7 @@ reboot [<n>]
-

2.52 Remove a File (rm)

+

2.53 Remove a File (rm)

@@ -2808,7 +2869,7 @@ nsh>
-

2.53 Remove a Directory (rmdir)

+

2.54 Remove a Directory (rmdir)

@@ -2843,7 +2904,7 @@ nsh>
-

2.54 Remove on OS Module (rmmod)

+

2.55 Remove on OS Module (rmmod)

@@ -2871,7 +2932,7 @@ nsh>
-

2.55 Show routing table (route)

+

2.56 Show routing table (route)

@@ -2891,7 +2952,7 @@ route ipv4|ipv6
-

2.56 Set an Environment Variable (set)

+

2.57 Set a Variable (set)

@@ -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:

- +

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

2.57 Execute an NSH Script (sh)

+

2.58 Execute an NSH Script (sh)

@@ -2978,7 +3044,7 @@ sh <script-path>
-

2.58 Shut the system down (shutdown)

+

2.59 Shut the system down (shutdown)

@@ -2999,7 +3065,7 @@ shutdown [--reboot]
-

2.59 Wait for Seconds (sleep)

+

2.60 Wait for Seconds (sleep)

@@ -3016,7 +3082,7 @@ sleep <sec>
-

2.60 Time Start the Telnet Daemon (telnetd)

+

2.61 Time Start the Telnet Daemon (telnetd)

@@ -3042,7 +3108,7 @@ telnetd
-

2.61 Time execution of another command (time)

+

2.62 Time execution of another command (time)

@@ -3100,7 +3166,7 @@ nsh>
-

2.62 Set the Size of a File (truncate)

+

2.63 Set the Size of a File (truncate)

@@ -3128,7 +3194,7 @@ truncate -s <length> <file-path>
-

2.63 Unmount a File System (umount)

+

2.64 Unmount a File System (umount)

@@ -3158,7 +3224,7 @@ nsh>
-

2.64 Print system information (uname)

+

2.65 Print system information (uname)

@@ -3225,7 +3291,7 @@ uname [-a | -imnoprsv]
-

2.65 Unset an Environment Variable (unset)

+

2.66 Unset an Environment Variable (unset)

@@ -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: