A new version of the GNU project’s Bourne Again SHell (better known to most of us as Bash) has been released, nearly 3 years after the last.
According the official release announcement Bash 5.3 includes ‘significant new features’ alongside an assortment of other improvements, fixes and compatibility updates.
The headline addition is a “new form of command substitution that executes the command in the current shell execution context
“.
This has two variants: one reads and returns command output as before, while the other punts the result into the REPLY shell variable when it finishes, which from glancing at the full changelog are:
${ command; }captures standard output without forking${| command; }runs in the current shell and leaves result inREPLY
Naturally, input and completion also see a boost in Bash 5.3.
A new GLOBSORT variable allows you to control sorting of pathname-completion results by name, size, blocks, mtime, atime, ctime, numeric, or none in ascending or descending order; and the source command’s new –p PATH flag lets you specify where to look for files.
Bash 5.3 now feeds results from the compgen builtin into a shell variable rather than writing them to the standard output; and the read builtin’s new -E option makes use of Readline completions, enabling tab-completion behaviour while you’re reading input too.
Readline is the library Bash uses for command editing, history and tab completion, and it sees new features too.
The changelog mentions “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.”
Bash 5.3 improves script handling and error reporting in various ways, such as printing an error message if a regular expression used with [[ fails to compile and checking the first two lines of a #! script before assuming it’s a binary.
See the full CHANGES file (linked further up) for a blow-by-blow rundown of everything that’s new and improved in Bash 5.3. Head to the GNU Bash page to download source code.
Bash is Ubuntu’s default shell and the default shell that the Terminal app uses. While some of us opt for other (fancier) shells like Zsh and Fish, Bash’s un-fussiness makes it a dependable companion for the majority of command-line needs.
