Skip to content

Commit

Permalink
Merge pull request #20 from sahal/main
Browse files Browse the repository at this point in the history
More table formatting fixes along with some extra formatting fixes for free
  • Loading branch information
flokoe authored Nov 13, 2024
2 parents 5fdf713 + 2849f0a commit 6cfac9a
Show file tree
Hide file tree
Showing 21 changed files with 393 additions and 419 deletions.
10 changes: 5 additions & 5 deletions docs/commands/builtin/cd.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ is given or the shell is configured to do so (see the `-P` option of

### Options

Option Description
-------- ----------------------------------------------------
`-L` Follow symbolic links (default)
`-P` Do not follow symbolic links
`-@` Browse a file's extended attributed, if supported
|Option|Description|
|------|-----------|
|`-L`|Follow symbolic links (default)|
|`-P`|Do not follow symbolic links|
|`-@`|Browse a file's extended attributed, if supported|

### Exit status

Expand Down
72 changes: 27 additions & 45 deletions docs/commands/builtin/declare.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,54 +30,36 @@ tagged as obsolete.
Below, `[-+]X` indicates an attribute, use `-X` to set the attribute,
`+X` to remove it.

----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Option Description
--------- ------------------------------------------------------------------------------------------------------------------------------------------------------------------
`[-+]a` make NAMEs indexed arrays (removing with `+a` is valid syntax, but leads to an error message)

`[-+]A` make NAMEs associative arrays

`[-+]c` **Undocumented** convert NAMEs to "capcase" on assignment (makes the first letter upper-case and the rest lower). Requires Bash built with `-DCASEMOD_CAPCASE`

`-f` restrict action or display to function names and definitions (removing with `+f` is valid syntax, but leads to an error message)

`-F` restrict display to function names only (plus line number and source file when debugging)

`-g` create global variables when used in a shell function; otherwise ignored (by default, `declare` declares local scope variables when used in shell functions)

`[-+]i` make NAMEs have the "integer" attribute

`[-+]l` convert NAMEs to lower case on assignment (makes sure the variable contains only lower case letters)

`[-+]n` make NAME a reference to the variable named by its value. Introduced in Bash 4.3-alpha.
''`${!NAME}`'' reveals the reference variable name, VALUE.
Use `unset -n NAME` to unset the variable. (`unset -v NAME` unsets the VALUE variable.)
Use `[[ -R NAME ]]` to test if NAME has been set to a VALUE, another variable's name.

`-p` display the attributes and value of each NAME

`[-+]r` make NAMEs readonly (removing with `+r` is valid syntax, but not possible)

`[-+]t` make NAMEs have the "trace" attribute (effective only for functions)

`[-+]u` convert NAMEs to upper case on assignment (makes sure the variable contains only upper case letters)

`[-+]x` make NAMEs exported
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|Option|Description|
|------|-----------|
|`[-+]a`|make NAMEs indexed arrays (removing with `+a` is valid syntax, but leads to an error message)|
|`[-+]A`|make NAMEs associative arrays|
|`[-+]c`|**Undocumented** convert NAMEs to "capcase" on assignment (makes the first letter upper-case and the rest lower). Requires Bash built with `-DCASEMOD_CAPCASE`|
|`-f`|restrict action or display to function names and definitions (removing with `+f` is valid syntax, but leads to an error message)|
|`-F`|restrict display to function names only (plus line number and source file when debugging)|
|`-g`|create global variables when used in a shell function; otherwise ignored (by default, `declare` declares local scope variables when used in shell functions)|
|`[-+]i`|make NAMEs have the "integer" attribute|
|`[-+]l`|convert NAMEs to lower case on assignment (makes sure the variable contains only lower case letters)|
|`[-+]n`|make NAME a reference to the variable named by its value. Introduced in Bash 4.3-alpha. ''`${!NAME}`'' reveals the reference variable name, VALUE. Use `unset -n NAME` to unset the variable. (`unset -v NAME` unsets the VALUE variable.) Use `[[ -R NAME ]]` to test if NAME has been set to a VALUE, another variable's name.|
|`-p`|display the attributes and value of each NAME|
|`[-+]r`|make NAMEs readonly (removing with `+r` is valid syntax, but not possible)|
|`[-+]t`|make NAMEs have the "trace" attribute (effective only for functions)|
|`[-+]u`|convert NAMEs to upper case on assignment (makes sure the variable contains only upper case letters)|
|`[-+]x`|make NAMEs exported|

### Return status

Status Reason
-------- ----------------------------------------------------------------------------------------
0 no error
!= 0 invalid option
!= 0 invalid variable name given
!= 0 attempt to **define** a function using `-f`
!= 0 assignment to a readonly variable
!= 0 removing the readonly-attribute from a readonly variable
!= 0 assignment to an array variable without the compound assignment syntax (`array=(...)`)
!= 0 attempt to use `+a` to "destroy" an array
!= 0 attemt to display a non-existent function with `-f`
|Status|Reason|
|------|------|
|0|no error|
|!= 0|invalid option|
|!= 0|invalid variable name given|
|!= 0|attempt to **define** a function using `-f`|
|!= 0|assignment to a readonly variable|
|!= 0|removing the readonly-attribute from a readonly variable|
|!= 0|assignment to an array variable without the compound assignment syntax (`array=(...)`)|
|!= 0|attempt to use `+a` to "destroy" an array|
|!= 0|attemt to display a non-existent function with `-f`|

## Notes

Expand Down
44 changes: 22 additions & 22 deletions docs/commands/builtin/echo.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,31 +16,31 @@ if given.

### Options

Option Description
-------- ----------------------------------------------------------------------------------------------------------------
`-n` The trailing newline is suppressed.
`-e` Interpretation of the following backslash-escaped characters (below) is enabled.
`-E` Disables the interpretation of these escape characters, even on systems where they are interpreted by default.
Option|Description|
------|-----------|
|`-n`|The trailing newline is suppressed.|
|`-e`|Interpretation of the following backslash-escaped characters (below) is enabled.|
|`-E`|Disables the interpretation of these escape characters, even on systems where they are interpreted by default.|

### Escape sequences

Escape Description
-------------- ---------------------------------------------------------------------------------------------------------------
`\a` alert (bell)
`\b` backspace
`\c` suppress further output
`\e`
`\E` an escape character
`\f` form feed
`\n` new line
`\r` carriage return
`\t` horizontal tab
`\v` vertical tab
`\\` backslash
`\0nnn` the eight-bit character whose value is the octal value nnn (zero to three octal digits)
`\xHH` the eight-bit character whose value is the hexadecimal value HH (one or two hex digits)
`\uHHHH` the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value HHHH (one to four hex digits)
`\UHHHHHHHH` the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value HHHHHHHH (one to eight hex digits)
|Escape|Description|
|------|-----------|
|`\a`|alert (bell)|
|`\b`|backspace|
|`\c`|suppress further output|
|`\e`|
|`\E`|an escape character|
|`\f`|form feed|
|`\n`|new line|
|`\r`|carriage return|
|`\t`|horizontal tab|
|`\v`|vertical tab|
|`\\`|backslash|
|`\0nnn`|the eight-bit character whose value is the octal value nnn (zero to three octal digits)|
|`\xHH`|the eight-bit character whose value is the hexadecimal value HH (one or two hex digits)|
|`\uHHHH`|the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value HHHH (one to four hex digits)|
|`\UHHHHHHHH`|the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value HHHHHHHH (one to eight hex digits)|

## Examples

Expand Down
10 changes: 5 additions & 5 deletions docs/commands/builtin/exec.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ shell without executing any program.

### Options

Option Description
----------- ----------------------------------------------------------------------------------------------------------------------
`-a NAME` Passes `NAME` as zeroth argument for the program to be executed
`-c` Execute the program with an empty (cleared) environment
`-l` Prepends a dash (`-`) to the zeroth argument of the program to be executed, similar to what the `login` program does
|Option|Description|
|------|-----------|
|`-a NAME`|Passes `NAME` as zeroth argument for the program to be executed|
|`-c`|Execute the program with an empty (cleared) environment|
|`-l`|Prepends a dash (`-`) to the zeroth argument of the program to be executed, similar to what the `login` program does|

### Exit status

Expand Down
6 changes: 3 additions & 3 deletions docs/commands/builtin/exit.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ There are no options.
Naturally, you can't ask for the exit status from within the shell that
executed the `exit` command, because the shell exits.

Status Reason
-------- ----------------------------------------------------------------------------
255 invalid (e.g. non-numeric) argument - this staus is returned to the parent
|Status|Reason|
|------|------|
|255|invalid (e.g. non-numeric) argument - this staus is returned to the parent|

## Examples

Expand Down
20 changes: 10 additions & 10 deletions docs/commands/builtin/export.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ it.

### Options

Option Description
-------- ------------------------------------------------------------------------------------------------------------
`-f` refer to shell functions
`-n` remove the export property from any referenced `NAME`
`-p` print all exported variables, with `-f`, print all exported functions - all in a format re-usable as input
|Option|Description|
|------|-----------|
|`-f`|refer to shell functions|
|`-n`|remove the export property from any referenced `NAME`|
|`-p`|print all exported variables, with `-f`, print all exported functions - all in a format re-usable as input|

An argument of `--` disables further option processing.

### Return status

Status Reason
-------- ---------------------------
0 no error
!=0 invalid option
!=0 a given `NAME` is invalid
|Status|Reason|
|------|------|
|0|no error|
|!=0|invalid option|
|!=0|a given `NAME` is invalid|

## Examples

Expand Down
26 changes: 13 additions & 13 deletions docs/commands/builtin/kill.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,22 +32,22 @@ external `kill` command of the operating system to

### Options

Option Description
------------------- -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
`-s SIGNAL` specifies the signal to send
`-n SIGNALNUMBER` specifies the signal to send
`-SIGNAL` specifies the signal to send
`-l [SIGNAL...]` Lists supported/known signal numbers and their symbolic name. If `SIGNAL` is given, only list this signal, translated (if a number is given the symbolic name is printed, and vice versa)
`-L [SIGNAL...]` Same as `-l [SIGNAL]` (compatiblity option)
|Option|Description|
|------|-----------|
|`-s SIGNAL`|specifies the signal to send|
|`-n SIGNALNUMBER`|specifies the signal to send|
|`-SIGNAL`|specifies the signal to send|
|`-l [SIGNAL...]`|Lists supported/known signal numbers and their symbolic name. If `SIGNAL` is given, only list this signal, translated (if a number is given the symbolic name is printed, and vice versa)|
|`-L [SIGNAL...]`|Same as `-l [SIGNAL]` (compatiblity option)|

### Return status

Status Reason
-------- -----------------------------------------------------------------------------------------------------
0 no error/success
!=0 invalid option
!=0 invalid signal specification
!=0 error returned by the system function (e.g. insufficient permissions to send to a specific process)
|Status|Reason|
|------|------|
|0|no error/success|
|!=0|invalid option|
|!=0|invalid signal specification|
|!=0|error returned by the system function (e.g. insufficient permissions to send to a specific process)|

## Examples

Expand Down
13 changes: 7 additions & 6 deletions docs/commands/builtin/let.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,13 @@ command](../../syntax/ccmd/arithmetic_eval.md):
$ echo "$a - $b - $?"
4 - 2 - 0

<WRAP info> Remember that inside arithmetic evaluation contexts, all
other expansions are processed as usual (from left-to-right), and the
resulting text is evaluated as an arithmetic expression. Arithmetic
already has a way to control precedence using parentheses, so it's very
rare to need to nest arithmetic expansions within one another. It's
used above only to illustrate how this precedence works. </WRAP>
!!! INFO ""
Remember that inside arithmetic evaluation contexts, all
other expansions are processed as usual (from left-to-right), and the
resulting text is evaluated as an arithmetic expression. Arithmetic
already has a way to control precedence using parentheses, so it's very
rare to need to nest arithmetic expansions within one another. It's
used above only to illustrate how this precedence works.

Unlike `((`, being a simple command `let` has its own environment. In
Bash, built-ins that can set variables process any arithmetic under
Expand Down
18 changes: 9 additions & 9 deletions docs/commands/builtin/mapfile.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ target array must be a "normal" integer indexed array.
`mapfile` returns success (0) unless an invalid option is given or the
given array `ARRAY` is set readonly.

Option Description
--------------- ---------------------------------------------------------------------------------------------------------------------------------------------------------------
`-c QUANTUM` Specifies the number of lines that have to be read between every call to the callback specified with `-C`. The default QUANTUM is 5000
`-C CALLBACK` Specifies a callback. The string `CALLBACK` can be any shell code, the index of the array that will be assigned, and the line is appended at evaluation time.
`-n COUNT` Reads at most `COUNT` lines, then terminates. If `COUNT` is 0, then all lines are read (default).
`-O ORIGIN` Starts populating the given array `ARRAY` at the index `ORIGIN` rather than clearing it and starting at index 0.
`-s COUNT` Discards the first `COUNT` lines read.
`-t` Remove any trailing newline from a line read, before it is assigned to an array element.
`-u FD` Read from filedescriptor `FD` rather than standard input.
|Option|Description|
|------|-----------|
|`-c QUANTUM`|Specifies the number of lines that have to be read between every call to the callback specified with `-C`. The default QUANTUM is 5000|
|`-C CALLBACK`|Specifies a callback. The string `CALLBACK` can be any shell code, the index of the array that will be assigned, and the line is appended at evaluation time.|
|`-n COUNT`|Reads at most `COUNT` lines, then terminates. If `COUNT` is 0, then all lines are read (default).|
|`-O ORIGIN`|Starts populating the given array `ARRAY` at the index `ORIGIN` rather than clearing it and starting at index 0.|
|`-s COUNT`|Discards the first `COUNT` lines read.|
|`-t`|Remove any trailing newline from a line read, before it is assigned to an array element.|
|`-u FD`|Read from filedescriptor `FD` rather than standard input.|

While `mapfile` isn't a common or portable shell feature, it's
functionality will be familiar to many programmers. Almost all
Expand Down
Loading

0 comments on commit 6cfac9a

Please sign in to comment.