(a)sh documentation

Alexis flexibeast at gmail.com
Fri Mar 7 01:12:55 UTC 2025


Hi all,

Currently, the documentation for BusyBox sh is only:

```
sh [-il] [-|+Cabefmnuvx] [-|+o OPT]... [-c 'SCRIPT' [ARG0 ARGS] |
          FILE ARGS | -s ARGS]

          Unix shell interpreter
```

i'd like the full usage information in ash.c to be expanded, e.g.:

```
//usage:#define ash_full_usage "\n\n"
//usage:	"Unix shell interpreter"
//usage:	"\n\n"
//usage:	"[-|+]a		Enable/disable 'allexport' 
option."
//usage:	"[-|+]b		Enable/disable 'notify' option."
//usage:	"-c 'SCRIPT'    Run command(s) SCRIPT.	
//usage:	"[-|+]C		Enable/disable 'noclobber' 
option."
//usage:	"[-|+]E		Enable/disable 'errtrace' option."
//usage:	"-i		Force the shell to be 
interactive."
//usage:	"-l		Make the shell a login shell.
//usage:	"[-|+]m         Enable the 'monitor' option."
//usage:	"[-|+]n		Enable the 'noexec' option."
//usage:	"[-|+]o OPT	Enable/disable OPT; with no 
argument, list
//usage:	"		options."
//usage:	"-s ARGS	Read commands ARGS from standard 
input."
//usage:	"[-|+]u		Enable/disable the 'nounset' 
option."
//usage:	"[-|+]v		Enable/disable the 'verbose' 
option."
//usage:        "[-|+]x         Enable/disable the 'xtrace' 
option."
```

(i've used tabs to separate the columns; hopefully they come 
through.)

There could also be an additional section explaining the meanings 
of
the options, e.g. (assuming Dash behaviour and quoting dash(1), 
except
for 'errtrace', which is not mentioned in that man page; ash.c 
doesn't
seem to offer any clues):

```
//usage:	"Options:\n\n"
//usage:	"allexport"
//usage:        "	Export all variables assigned to."
//usage:	"errtrace"
//usage:	"	[...]"
//usage:	"monitor"
//usage:        "	Turn on job control (set automatically 
when"
//usage:	"	interactive).
//usage:	"noclobber"
//usage:	"	Don't overwrite existing files with '>'."
//usage:	"noexec"
//usage:	"	If not interactive, read commands but do 
not"
//usage:	"	execute them.  This is useful for checking 
the"
//usage:	"	syntax of shell scripts."
//usage:	"notify"
//usage:	"	Enable asynchronous notification of 
background job"
//usage:	"	completion."
//usage:	"nounset"
//usage:	"	Write a message to standard error when 
attempting"
//usage:	"	to expand a variable that is not set, and 
if the"
//usage:        "	shell is not interactive, exit 
immediately."
//usage:	"verbose"
//usage:	"	The shell writes its input to standard 
error as it"
//usage:        "	is read.  Useful for debugging."
//usage:	"xtrace"
//usage:	"	Write each command to standard error 
(preceded by"
//usage:	"	a '+ ') before it is executed.  Useful 
for"
//usage:	"	debugging."
```

Thoughts?


Alexis.


More information about the busybox mailing list