bash 5.2 released

The first public version of bash-5.2 is now available at the URLs below. Details for the start DevOps course – under the cut.

Bash is a GNU Bourne Again SHell project, a complete implementation of the POSIX shell specification with interactive command line editing, task control on architectures where it is supported, csh-like functionality (history substitution and parenthesis expansion), and more. For more information about the Bash functionality new to this type of shell, see the file doc/bashref.texi. There is also a large man page, like on Unix, with a complete description of the shell’s functionality.

To report bugs in this version, use bashbug. The program is built and installed at the same time as bash.

Installation

Read the README file first. Installation instructions are in the INSTALL.

New functionality

This is an update to the fifth major release of bash.

See the NEWS file of the bash-5.2 distribution for a complete description of the new functionality. Below is a copy of the relevant snippets.

This release fixes bugs in bash-5.1 and adds new functionality.

Fixed bugs that caused the shell to crash. Details are in CHANGES.

The most notable new feature is a rewritten command substitution parsing code that recursively calls bison. This is a replacement for legacy parsing, designed to improve syntax checking and catch syntax errors much earlier. Parsing in the shell should be much better, allowing only one expansion of array indexes. This is expressed in built-in unset, in word expansions, in conditional constructs, etc., in which the values ​​of variables can be assigned as a side effect. built-in command unset in associative arrays unset the key with the index value @ or *. You can cancel it for the entire array with unset arrayname.

There is a new shell option patsub_replacement. When it is on, the symbol & in the replacement string, the expansion of the pattern substitution is replaced by the part of the string that matches that pattern. A backslash escapes and inserts a character into a literal &. This option is enabled by default. Added cases to bash where branching is not allowed, including in most cases with $(<file).

See below for a description of all the new functionality.

This option also appeared in Readline. In particular, the new parameter enable-active-regionwith which the active region and bracketed-paste controlled separately. Its default value for them is the same, when activated bracketed-paste the active area is also activated. Users can now disable it by leaving it enabled bracketed-paste. Two new bindable string variables are available. Their values ​​are terminal escape sequences, one of which sets the color for displaying the active area, and the other turns it off. When given, they are used instead of terminal mode standout. Finally, Readline now checks for changes to the language settings (`LC_ALL/LC_CTYPE/LANG`) on each call, and changes the locale to match the corresponding language mapping and key binding variables.

There are several changes that break compatibility between bash-5.1 and bash-5.2. If the shell compatibility level is 50 or lower, the here-doc and here lines use temporary files. Working builtin in bash-5.2 unset with array indices @ and * differs from previous versions and depends on whether it is an index array or an associative one. bash-5.2 should prevent double expansion of array indices, which occurs in certain circumstances (especially in arithmetic calculations) as if a shell option had been given assoc_expand_once. To revert to the previous behavior, set the appropriate compatibility level. More details in COMPAT file.

If necessary, Bash can be linked against the already installed Readline library, rather than the private version in lib/readline. Only in version readline-8.1 and later, all characters required for bash-5.2; past versions of the Readline library will not work correctly.

Full list of changes between bash-5.1 and bash-5.2 too big to include here. It is contained in the CHANGES file.

Readline

Version 8.2 of the standalone Readline library is available with its own configuration scripts and Makefiles. You can get it from the URLs:

Formatted Readline documentation is contained in the distribution’s tar file readline. Changes in Readline are described separately. As always, thanks for your help.

This is a brief description of the new functionality bash-5.2. As always, see the man page for full descriptions (doc/bash.1).

New functionality in bash

  1. AT bash when called malloc 16-byte aligned memory is returned.
  2. To read timeouts, a new built-in timer framework is used.
  3. To recursively call the parser and rebuild the command line from the parsed command, the code for command substitution parsing has been rewritten. As a result, syntax checking improves, and errors are caught much earlier. In this case, if after parsing the command substitution it remains to read the here-doc, a warning message is displayed in the shell and the body of the here-doc is read from the current input stream.
  4. operand in built-in ulimit, which remains after parsing all parameters and arguments, is now considered the argument of the last command specified in the parameter. This is for POSIX compatibility.
  5. When reading the here-doc body, parsing is performed $'...' and $"...".
  6. Bindable readline commands can work shell-expand-line and history-and-alias-expand-line With '...' and $"...".
  7. Added bindable readline command spell-correct-word to check the spelling of the current word.
  8. In built-in unset arguments should now be treated as array indexes without parsing or incrementing the index, even when not given assoc_expand_once.
  9. AT config-top.h there is a default value for $BASH_LOADABLES_PATH.
  10. Associative array assignment and some cases of references, for example with test -v now you can use @ and * like keys.
  11. In bash, when shell constructs and word expansions are executed, index array indices need only be expanded once.
  12. In built-in unset unset key with index value @ or * for associative arrays. You can cancel it for the entire array with unset arrayname. In index arrays, all their elements are removed without unsetting the key, for example A=().
  13. In other builtin commands (printf/test/read/wait) it is better not to parse array indexes if array_expand_once is set.
  14. A new variable has been set to the numeric argument of readline commands READLINE_ARGUMENTdetermined using bind -x.
  15. New shell option varredir_close causes automatic closure in bash file descriptors opened with {var}exec.
  16. In the script name when running any (non-interactive) boot files such as $BASH_ENVnow a special parameter is set $0.
  17. AT enable name when trying to include a built-in command without any parameters, which is not present, in the built-in enable should load (using the default search path) a loadable builtin command.
  18. In built-in printf the %Q format specifier appeared. Differs from %q in that any given precision is applied to the unquoted original argument, then it is quoted, and the result is printed.
  19. New parameter noexpand_translations determines whether the converted output is enclosed in single quotes $«…».
  20. Parameter conversion operator appeared @k. Unlike @Kafter splitting the words, the result in it is expanded to separate words.
  21. There is an alternative implementation of the array, selected during configure (settings). It optimizes access speed by using more memory (uses a new configuration parameter --enable-alt-array-implementation).
  22. If in redirect [N]<&WORD- or [N]>&WORD- WORD expands to the empty string, it will be treated as[[N]<&- or [N]>&- and file descriptor N (default 0) will close.
  23. Invalid parameter conversion operators are now invalid word expansions and therefore cause fatal errors in non-interactive shells.
  24. There is a new shell option patsub_replacement. When it is on, the symbol & in the replacement string, the expansion of the pattern substitution is replaced by the part of the string that matches that pattern. Symbol & is escaped with a backslash and a literal is inserted.
  25. command -p no longer used to look up commands in the hash table.
  26. To include or exclude support from the compilation $«…»the parameter appeared configure -enable-translatable-strings.
  27. So that when expanding the path name, never return . or . (if there is no explicit match), a shell parameter appeared globskipdots. It is enabled by default.
  28. Array references using @ and * as the value of variables nameref (declare -n ref="v[@]"; echo $ref) no longer cause shell exits when enabled set -uand setting array (v) cancelled.
  29. A new name for the binded readline command has appeared: vi-edit-and-execute-command.
  30. In posix mode inline printf check for length modifier L. For floating point conversion specifiers, use long double. And if they are not – double.
  31. There was a parameter globstarwhich is taken into account when autocompleting code in globbing. ff. FROM suspend -f now the shell is suspended even if task control is disabled. gg. Because no declare - (equivalent local -), usage local - in the output local -p necessarily.

New Readline functionality

  1. The history library version number for use in applications is now contained in HS_HISTORY_VERSION.
  2. Multiple story disclosure is being finalized with lines that could previously be an obstacle for this (for example, abc!$!$).
  3. There is a new framework for readline timeouts. And with it, new public functions for setting timeouts and asking for time before they fire. And also an interception function that can be activated after the readline time has elapsed. There is now a new state value to indicate the timeout.
  4. Keyboard shortcuts with automatic binding to termcap for scrolling forward and backward history-search-backward and history-search-forward respectively.
  5. There is a new bindable command to get a record by a numeric argument fetch-history. Negative arguments are counted from the end of the story.
  6. Now vi-undo – bind command.
  7. There was a parameter enable-active-regionwith which the active region and bracketed-paste controlled separately. Its default value for them is the same, when activated bracketed-paste the active area is also activated. Users can now disable it by leaving bracketed-paste enabled.
  8. Now rl_completer_word_break_characters – this is const char *how rl_basic_word_break_characters.
  9. Readline is used to look up a custom filename extension in $LS_COLORS (*.readline-colored-completion-prefix), which is used as the default color for displaying the common prefix when given colored-completion-prefix.
  10. Two new bindable string variables active-region-start-color and active-region-end-color. The first is to set the color for displaying the active area, the second is to turn it off. When given, they are used instead of terminal mode standout.
  11. With new condition readline (RL_STATE_EOF) an application-visible variable (rl_eof_found) in applications, you can determine when in readline reading up to EOF (end of file) before calling the hook deprep-terminal.
  12. There is a new configuration option -with-shared-termcap-librarywhich forces shared libraries to be linked readline and termcap (or curses/ncurses/termlib), so applications do not need to do this.
  13. AT readline now, on each call, it checks for changes in the language settings (LC_ALL/LC_CTYPE/LANG), and when the locale changes, the corresponding language display and variables with key bindings change.

We will help you understand bash and not only so that you can upgrade your career and become a sought-after IT specialist:

To see all courses, click on the banner:

Brief catalog of courses

Data Science and Machine Learning

Python, web development

Mobile development

Java and C#

From basics to depth

As well as

Similar Posts

Leave a Reply