Bash 5.3 — significant new features

3 hours ago 2

The GNU project's Bourne Again SHell (Bash) has released version 5.3, with some significant new features, including some from the associated Readline 8.3 release, which provides command-line editing and other features for Bash and lots of other programs. Bash 5.3 has a "new form of command substitution that executes the command in the current shell execution context", pathname-completion sorting will be handled based on the

GLOBSORT

shell variable, generated completions can go to a shell variable instead of to stdout, the source code has been updated to C23, and more. Meanwhile:

Readline has new features as well. There is a new option that allows case-insensitive searching, a new command that executes a named readline command, and a new command that exports possible word completions in a specified format for consumption by another process.
From:  Chet Ramey <chet.ramey-AT-case.edu>
To:  bug-bash-AT-gnu.org, help-bash-AT-gnu.org
Subject:  Bash-5.3-release available
Date:  Sat, 05 Jul 2025 11:57:21 -0400
Message-ID:  <[email protected]>
Cc:  chet.ramey-AT-case.edu, gnu-announce-AT-gnu.org, info-gnu-AT-gnu.org, bash-announce-AT-gnu.org
Archive-link:  Article
Introduction ============ The first public release of bash-5.3 is now available with the URLs ftp://ftp.cwru.edu/pub/bash/bash-5.3.tar.gz ftp://ftp.gnu.org/pub/gnu/bash/bash-5.3.tar.gz and from the master branch of the bash git repository (http://git.savannah.gnu.org/cgit/bash.git/log/) and the usual GNU mirror sites. Bash is the GNU Project's Bourne Again SHell, a complete implementation of the POSIX shell spec, but also with interactive command line editing, job control on architectures that support it, csh-like features such as history substitution and brace expansion, and a slew of other features. For more information on the features of Bash that are new to this type of shell, see the file `doc/bashref.texi'. There is also a large Unix-style man page. The man page is the definitive description of the shell's features. This tar file includes the formatted documentation (pdf, postscript, dvi, info, and html, plus nroffed versions of the manual pages). Please use `bashbug' to report bugs with this version. It is built and installed at the same time as bash. Installation ============ Please read the README file first. Installation instructions are provided in the INSTALL file. New Features ============ This is an update to the fifth major release of bash. Read the file NEWS in the bash-5.3 distribution for a complete description of the new features. A copy of the relevant portions is included below. This release fixes several outstanding bugs in bash-5.2 and introduces a number of new features. There are a number of bug fixes, including several bugs that caused the shell to crash. Complete details are available in the CHANGES file. There are significant new features of note: * There is a new form of command substitution that executes the command in the current shell execution context. Two forms are implemented: one that reads the command substitution's output and another that expects to find the result in the REPLY shell variable when the command substitution completes. * The GLOBSORT shell variable determines how the shell will sort the results of pathname completion. * The compgen builtin has an option to put the generated completions into a designated shell variable instead of writing them to the standard output. * The read builtin has a new `-E' option that uses readline with the default bash completion, including programmable completion. * The source builtin has a new `-p PATH' option, which makes it use the PATH argument instead of $PATH to search for the file. The source code has been updated for C23 conformance. This means that bash will no longer compile with K&R-style C compilers. All the new features are described below. Readline has new features as well. There is a new option that allows case-insensitive searching, a new command that executes a named readline command, and a new command that exports possible word completions in a specified format for consumption by another process. There are a few incompatible changes between bash-5.2 and bash-5.3. The test builtin uses slightly different parsing behavior when parenthesized subexpressions are present and test has been supplied more than four arguments, for compatibility with coreutils. When the shell is running interactively, it no longer notifies about completed jobs while sourcing a script, deferring notification until the script completes. Bash can be linked against an already-installed Readline library rather than the private version in lib/readline if desired. Only readline-8.1 and later versions are able to provide all of the symbols that bash-5.3 requires; earlier versions of the Readline library will not work correctly. A complete list of changes between bash-5.2 and bash-5.3 is available in the file CHANGES; the complete list is too large to include in this message. Readline ======== Also available is a new release of the standalone Readline library, version 8.3, with its own configuration scripts and Makefiles. It can be retrieved with the URLs ftp://ftp.cwru.edu/pub/bash/readline-8.3.tar.gz ftp://ftp.gnu.org/pub/gnu/readline/readline-8.3.tar.gz and from the master branch of the GNU readline git repository (http://git.savannah.gnu.org/cgit/readline.git/log/) and the usual GNU mirror sites. The formatted Readline documentation is included in the readline distribution tar file. The changes in Readline are described in a separate announcement. As always, thanks for your help. Chet +========== NEWS ==========+ This is a terse description of the new features added to bash-5.3 since the release of bash-5.2. As always, the manual page (doc/bash.1) is the place to look for complete descriptions. 1. New Features in Bash a. When checking whether a script file argument is a binary file, check the first two lines of a script if the first line begins with `#!'. b. Bash does a better job of preserving user-supplied quotes around a word completion, instead of requoting it. c. Bash reports the starting line number in an error message about an unterminated compound command like `if' without a `fi'. d. Implement the POSIX requirement that running the `jobs' builtin removes jobs from the jobs list. f. Call bash signal handlers while executing programmable completion commands, instead of readline's. g. Print an error message if a regular expression used with [[ fails to compile. h. The `umask' builtin now has additional features for full POSIX conformance. i. `type -a -P' reports both hashed pathnames and the result of a $PATH search. j. `trap' has a new -P option that prints the trap action associated with each signal argument. k. The `command' builtin preceding a declaration builtin (e.g., `declare') preserves the special asisgnment statement parsing for the declaration builtin. This is a new POSIX requirement. l. `printf' uses the `alternate form' for %q and %Q to force single quoting. m. `printf' now interprets %ls (%S) and %lc (%C) as referring to wide strings and characters, respectively, when in a multibyte locale. n. The shell can be compiled with a different default value for the patsub_replacement option. o. Check for window size changes during trap commands, `bind -x' commands, and programmable completion. p. Treat a NULL value for $PATH as equivalent to ".". p. New loadable builtins: kv, strptime q. GLOBSORT: new variable to specify how to sort the results of pathname expansion (name, size, blocks, mtime, atime, ctime, numeric, none) in ascending or descending order. r. `compgen' has a new option: -V varname. If supplied, it stores the generated completions into VARNAME instead of printing them on stdout. s. New form of command substitution: ${ command; } or ${|command;} to capture the output of COMMAND without forking a child process and using pipes. t. array_expand_once: new shopt option, replaces assoc_expand_once u. complete/compopt new option: fullquote; sets rl_full_quoting_desired so all possible completions are quoted as if they were filenames. v. Command timing now allows precisions up to 6 digits instead of 3 in $TIMEFORMAT. w. BASH_MONOSECONDS: new dynamic variable that returns the value of the system's monotonic clock, if one is available. x. BASH_TRAPSIG: new variable, set to the numeric signal number of the trap being executed while it's running. y. The checkwinsize option can be used in subshell commands started from interactive shells. z. In posix mode, the test command < and > binary primaries compare strings using the current locale. aa. bind -x allows new key binding syntax: separate the key sequence and the command string with whitespace, but require the command string to be double-quoted if this is used. This allows different quoting options for the command string. bb. Print commands bound to key sequences using `bind -x' with the new key binding syntax it allows. cc. `read' has a new `-E' option to use readline but with the default bash completion (including programmable completion). dd. New bindable readline command name: `bash-vi-complete'. ee. New test builtin behavior when parsing a parenthesized subexpression and test was given more than 4 arguments: scan forward for a closing paren and call posixtest() if there are 4 or fewer arguments between the parentheses. Added for compatibility with coreutils test, dependent on the shell compatibility level. Such expressions remain ambiguous. ff. MULTIPLE_COPROCS is now enabled by default. gg. The `bind' builtin interprets additional non-option arguments after -p or -P as bindable command names and restricts output to the bindings for those names. hh. Bash now uses the login shell for $BASH if the shell is named `su' or `-su'. ii. Bash now prints job notifications if an interactive shell is running a trap, even though the shell is not interactive at that moment. jj. Programmable completion allows a new compspec loaded after a completion function returns 124 to be used in more cases. kk. ./source has a new -p PATH option, which makes it use the PATH argument instead of $PATH to look for the file. ll. Documentation has been significantly updated. mm. `wait -n' can now return terminated process substitutions, jobs about which the user has already been notified (like `wait' without options), nn. `wait -n' removes jobs from the jobs table or list of terminated children when in posix mode. oo. Changed the `wait' builtin behavior regarding process substitutions to match the documentation. pp. There is a new `bash_source_fullpath' shopt option, which makes bash put full pathnames into BASH_SOURCE, and a way to set a default value for it at configure time. qq. Posix mode now forces job notifications to occur when the new edition of POSIX specifies (since it now specifies them). rr. Interactive shells don't print job notifications while sourcing scripts. ss. The parser prints more information about the command it's trying to parse when it encounters EOF before completing the command. tt. Posix mode no longer requires function names to be valid shell identifiers. uu. If `exit' is run in a trap and not supplied an exit status argument, it uses the value of $? from before the trap only if it's run at the trap's `top level' and would cause the trap to end (that is, not in a subshell). This is from Posix interp 1602. vv. There is a new `fltexpr' loadable builtin to perform floating-point arithmetic similarly to `let'. ww. The `install-strip' and `strip' Makefile targets now deal with cross- compiling. 2. New Features in Readline a. Output a newline if there is no prompt and readline reads an empty line. b. The history library falls back to stdio when writing the history list if mmap fails. c. New bindable variable `search-ignore-case', causes readline to perform case-insensitive incremental and non-incremental history searches. d. rl_full_quoting_desired: new application-settable variable, causes all completions to be quoted as if they were filenames. e. rl_macro_display_hook: new application-settable function pointer, used if the application wants to print macro values itself instead of letting readline do it f. rl_reparse_colors: new application-callable function, reparses $LS_COLORS (presumably after the user changes it) g. rl_completion_rewrite_hook: new application-settable function pointer, called to modify the word being completed before comparing it against pathnames from the file system. h. execute-named-command: a new bindable command that reads the name of a readline command from the standard input and executes it. Bound to M-x in emacs mode by default. i. Incremental and non-incremental searches now allow ^V/^Q (or, in the former case, anything bound to quoted-insert) to quote characters in the search string. j. There is a new rl_print_keybinding function that prints the key bindings for a single bindable function specified by name. k. Documentation has been significantly updated. l. New `force-meta-prefix' bindable variable, which forces the use of ESC as the meta prefix when using "\M-" in key bindings instead of overloading convert-meta. m. The default value for `readline-colored-completion-prefix' no longer has a leading `.'; the original report was based on a misunderstanding. n. There is a new bindable command, `export-completions', which writes the possible completions for a word to the standard output in a defined format. o. Readline can reset its idea of the screen dimensions when executing after a SIGCONT. -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU [email protected] http://tiswww.cwru.edu/~chet/

Read Entire Article