Documentation/nsh: Add stderr and stdin redirection documentation

This commit updates the NSH documentation about redirection syntax.

This documentation update corresponds to the stderr redirection feature
added in nuttx-apps PR #3378.

Signed-off-by: fangpeina <fangpeina@xiaomi.com>
This commit is contained in:
fangpeina
2026-02-02 16:19:26 +08:00
committed by simbit18
parent f794238bb8
commit 35e579d2d3
+9 -6
View File
@@ -89,23 +89,26 @@ Command Overview
(NSH) is a simple shell application. NSH supports the following
commands forms:
=============================== ======================================
=============================== ==========================================
Simple command ``<cmd>``
Command with re-directed output ``<cmd> > <file> <cmd> >> <file>``
Command with re-directed input ``<cmd> < <file>``
Command with re-directed output ``<cmd> > <file>`` ``<cmd> >> <file>``
Command with re-directed error ``<cmd> 2> <file>`` ``<cmd> 2>> <file>``
Redirect stderr to stdout ``<cmd> > <file> 2>&1``
Background command ``<cmd> &``
Re-directed background command ``<cmd> > <file> & <cmd> >> <file> &``
=============================== ======================================
Re-directed background command ``<cmd> > <file> &`` ``<cmd> >> <file> &``
=============================== ==========================================
Where:
* ``<cmd>`` is any one of the simple commands listed later.
* ``<file>`` is the full or relative path to any writable object in the file system name space (file or character driver). Such objects will be referred to simply as files throughout this document.
* ``<file>`` is the full or relative path to any readable or writable object in the file system name space (file or character driver). Such objects will be referred to simply as files throughout this document.
``nice`` **'d Background Commands**. NSH executes at the
mid-priority (128). Backgrounded commands can be made to execute
at higher or lower priorities using ``nice``::
[nice [-d <niceness>>]] <cmd> [> <file>|>> <file>] [&]
[nice [-d <niceness>>]] <cmd> [< <file>] [> <file>|>> <file>] [2> <file>|2>> <file>|2>&1] [&]
Where ``<niceness>`` is any value between -20 and 19 where lower
(more negative values) correspond to higher priorities. The