Fix minor formatting for Markdown

This commit is contained in:
flokoe 2023-07-04 13:11:57 +02:00
parent 375586c22d
commit 6e4f649350

View File

@ -1,12 +1,9 @@
# Bash 4 - a rough overview # Bash 4 - a rough overview
:V4: !!! warning "Attention"
Since Bash 4 has been around for quite some time now (4.3 will come soon), I consider it to be "standard".
\<note\>Attention: Since Bash 4 has been around for quite some time now This page is not maintained anymore and is left here to keep your links working.
(4.3 will come soon), I consider it to be \"standard\". This page is not See the [bashchanges](/scripting/bashchanges) page for new stuff introduced.
maintained anymore and is left here to keep your links working. See the
[bashchanges](/scripting/bashchanges) page for new stuff
introduced.\</note\>
Besides many bugfixes since Bash 3.2, Bash 4 will bring some interesting Besides many bugfixes since Bash 3.2, Bash 4 will bring some interesting
new features for shell users and scripters. See also new features for shell users and scripters. See also
@ -15,23 +12,19 @@ more details.
Not all of the changes and news are included here, just the biggest or Not all of the changes and news are included here, just the biggest or
most interesting ones. The changes to completion, and the readline most interesting ones. The changes to completion, and the readline
component are not covered. **Though, if you\'re familiar with these component are not covered. **Though, if you're familiar with these parts of Bash (and Bash 4), feel free to write a chapter here.**
parts of Bash (and Bash 4), feel free to write a chapter here.**
The complete list of fixes and changes is in the CHANGES or NEWS file of The complete list of fixes and changes is in the CHANGES or NEWS file of
your Bash 4 distribution. your Bash 4 distribution.
\<WRAP center round download 60%\> The current available **stable** The current available **stable** version is 4.4.18 release (February 03, 2018):
version is 4.4.18 release (February 03, 2018):
- <ftp://ftp.cwru.edu/pub/bash/bash-4.4.18.tar.gz> - <ftp://ftp.cwru.edu/pub/bash/bash-4.4.18.tar.gz>
- <ftp://ftp.gnu.org/pub/gnu/bash/bash-4.4.18.tar.gz> - <ftp://ftp.gnu.org/pub/gnu/bash/bash-4.4.18.tar.gz>
\</WRAP\>
## New or changed commands and keywords ## New or changed commands and keywords
### The new \"coproc\" keyword ### The new "coproc" keyword
Bash 4 introduces the concepts of coprocesses, a well known feature of Bash 4 introduces the concepts of coprocesses, a well known feature of
other shells. The basic concept is simple: It will start any command in other shells. The basic concept is simple: It will start any command in
@ -43,7 +36,7 @@ communicate with its input and output data streams.
See [The coproc keyword](/syntax/keywords/coproc) See [The coproc keyword](/syntax/keywords/coproc)
### The new \"mapfile\" builtin ### The new "mapfile" builtin
The `mapfile` builtin is able to map the lines of a file directly into The `mapfile` builtin is able to map the lines of a file directly into
an array. This avoids having to fill an array yourself using a loop. It an array. This avoids having to fill an array yourself using a loop. It
@ -52,7 +45,7 @@ callback, for example to display a progress bar.
See: [mapfile](/commands/builtin/mapfile) See: [mapfile](/commands/builtin/mapfile)
### Changes to the \"case\" keyword ### Changes to the "case" keyword
The `case` construct understands two new action list terminators: The `case` construct understands two new action list terminators:
@ -64,7 +57,7 @@ pattern instead of terminating the whole execution.
See [case](/syntax/ccmd/case) See [case](/syntax/ccmd/case)
### Changes to the \"declare\" builtin ### Changes to the "declare" builtin
The `-p` option now prints all attributes and values of declared The `-p` option now prints all attributes and values of declared
variables (or functions, when used with `-f`). The output is fully variables (or functions, when used with `-f`). The output is fully
@ -77,7 +70,7 @@ assignment.
`declare -A` declares associative arrays (see below). `declare -A` declares associative arrays (see below).
### Changes to the \"read\" builtin ### Changes to the "read" builtin
The `read` builtin command has some interesting new features. The `read` builtin command has some interesting new features.
@ -95,7 +88,7 @@ able to change the text, or press return to accept it.
See [read](/commands/builtin/read) See [read](/commands/builtin/read)
### Changes to the \"help\" builtin ### Changes to the "help" builtin
The builtin itself didn\'t change much, but the data displayed is more The builtin itself didn\'t change much, but the data displayed is more
structured now. The help texts are in a better format, much easier to structured now. The help texts are in a better format, much easier to
@ -104,7 +97,7 @@ read.
There are two new options: `-d` displays the summary of a help text, There are two new options: `-d` displays the summary of a help text,
`-m` displays a manpage-like format. `-m` displays a manpage-like format.
### Changes to the \"ulimit\" builtin ### Changes to the "ulimit" builtin
Besides the use of the 512 bytes blocksize everywhere in POSIX mode, Besides the use of the 512 bytes blocksize everywhere in POSIX mode,
`ulimit` supports two new limits: `-b` for max socket buffer size and `ulimit` supports two new limits: `-b` for max socket buffer size and
@ -135,13 +128,15 @@ When using substring expansion on the positional parameters, a starting
index of 0 now causes \$0 to be prepended to the list (if the positional index of 0 now causes \$0 to be prepended to the list (if the positional
parameters are used). Before, this expansion started with \$1: parameters are used). Before, this expansion started with \$1:
```bash
# this should display $0 on Bash v4, $1 on Bash v3 # this should display $0 on Bash v4, $1 on Bash v3
echo ${@:0:1} echo ${@:0:1}
```
### Globbing ### Globbing
There\'s a new shell option `globstar`. When enabled, Bash will perform There's a new shell option `globstar`. When enabled, Bash will perform
recursive globbing on `**` \-- this means it matches all directories and recursive globbing on `**` this means it matches all directories and
files from the current position in the filesystem, rather than only the files from the current position in the filesystem, rather than only the
current level. current level.
@ -158,11 +153,13 @@ associative arrays.
An associative array is an array indexed by an arbitrary string, An associative array is an array indexed by an arbitrary string,
something like something like
```bash
declare -A ASSOC declare -A ASSOC
ASSOC[First]="first element" ASSOC[First]="first element"
ASSOC[Hello]="second element" ASSOC[Hello]="second element"
ASSOC[Peter Pan]="A weird guy" ASSOC[Peter Pan]="A weird guy"
```
See [arrays](/syntax/arrays) See [arrays](/syntax/arrays)
@ -179,11 +176,11 @@ See [redirection](/syntax/redirection)
## Interesting new shell variables ## Interesting new shell variables
Variable Description | Variable | Description |
---------------------------------------------------- -------------------------------------------------------------------------------- | -------------------------------------------------- | ------------------------------------------------------------------------------- |
[BASHPID](/syntax/shellvars#BASHPID) contains the PID of the current shell (this is different than what `$$` does!) | [BASHPID](/syntax/shellvars#BASHPID) | contains the PID of the current shell (this is different than what `$$` does!) |
[PROMPT_DIRTRIM](/syntax/shellvars#PROMPT_DIRTRIM) specifies the max. level of unshortened pathname elements in the prompt | [PROMPT_DIRTRIM](/syntax/shellvars#PROMPT_DIRTRIM) | specifies the max. level of unshortened pathname elements in the prompt |
[FUNCNEST](/syntax/shellvars#FUNCNEST) control the maximum number of shell function recursions | [FUNCNEST](/syntax/shellvars#FUNCNEST) | control the maximum number of shell function recursions |
See [shellvars](/syntax/shellvars) See [shellvars](/syntax/shellvars)
@ -192,13 +189,13 @@ See [shellvars](/syntax/shellvars)
The mentioned shell options are **off by default** unless otherwise The mentioned shell options are **off by default** unless otherwise
mentioned. mentioned.
Option Description | Option | Description |
------------- -------------------------------------------------------------------------------------------------------- | ----------- | ------------------------------------------------------------------------------------------------------ |
`checkjobs` check for and report any running jobs at shell exit | `checkjobs` | check for and report any running jobs at shell exit |
`compat*` set compatiblity modes for older shell versions (influences regular expression matching in `[[ ... ]]` | `compat*` | set compatiblity modes for older shell versions (influences regular expression matching in `[[ ... ]]` |
`dirspell` enables spelling corrections on directory names during globbing | `dirspell` | enables spelling corrections on directory names during globbing |
`globstar` enables recursive globbing with `**` | `globstar` | enables recursive globbing with `**` |
`lastpipe` (4.2) to execute the last command in a pipeline in the current environment | `lastpipe` | (4.2) to execute the last command in a pipeline in the current environment |
See [shell_options](/internals/shell_options) See [shell_options](/internals/shell_options)