m. The printf builtin has a new %(fmt)T specifier, which allows time values to use strftime-like formatting. n. There is a new `compat41' shell option. o. The cd builtin has a new Posix-mandated `-e' option. p. Negative subscripts to indexed arrays, previously errors, now are treated as offsets from the maximum assigned index + 1. q. Negative length specifications in the ${var:offset:length} expansion, previously errors, are now treated as offsets from the end of the variable. ... ... ... t. There is a new `lastpipe' shell option that runs the last command of a pipeline in the current shell context. The lastpipe option has no effect if job control is enabled. ------------------------------------------------------------------------------- This is a terse description of the new features added to bash-4.1 since the release of bash-4.0. As always, the manual page (doc/bash.1) is the place to look for complete descriptions. e. `printf -v' can now assign values to array indices. f. New `complete -E' and `compopt -E' options that work on the "empty" completion: completion attempted on an empty command line. g. New complete/compgen/compopt -D option to define a `default' completion: a completion to be invoked on command for which no completion has been defined. If this function returns 124, programmable completion is attempted again, allowing a user to dynamically build a set of completions as completion is attempted by having the default completion function install individual completion functions each time it is invoked. h. When displaying associative arrays, subscripts are now quoted. i. Changes to dabbrev-expand to make it more `emacs-like': no space appended after matches, completions are not sorted, and most recent history entries are presented first. j. The [[ and (( commands are now subject to the setting of `set -e' and the ERR trap. ... ... ... q. The < and > operators to the [[ conditional command now do string comparison according to the current locale if the compatibility level is greater than 40.
B1) What's new in version 3.2?Bash-3.2 is the second maintenance release of the third major release of bash. It contains the following significant new features (see the manual page for complete descriptions and the CHANGES and NEWS files in the bash-3.2 distribution).
Bash-3.2 now checks shell scripts for NUL characters rather than non-printing characters when deciding whether or not a script is a binary file. Quoting the string argument to the [[ command's =~ (regexp) operator now forces string matching, as with the other pattern-matching operators. A short feature history dating from Bash-2.0:
Bash-3.1 contained the following new features:
Bash-3.1 may now be configured and built in a mode that enforces strict POSIX compliance. The `+=' assignment operator, which appends to the value of a string or array variable, has been implemented. It is now possible to ignore case when matching in contexts other than filename generation using the new `nocasematch' shell option. Bash-3.0 contained the following new features:
Features to support the bash debugger have been implemented, and there is a new `extdebug' option to turn the non-default options on HISTCONTROL is now a colon-separated list of options and has been extended with a new `erasedups' option that will result in only one copy of a command being kept in the history list Brace expansion has been extended with a new {x..y} form, producing sequences of digits or characters Timestamps are now kept with history entries, with an option to save and restore them from the history file; there is a new HISTTIMEFORMAT variable describing how to display the timestamps when listing history entries The `[[' command can now perform extended regular expression (egrep-like) matching, with matched subexpressions placed in the BASH_REMATCH array variable A new `pipefail' option causes a pipeline to return a failure status if any command in it fails The `jobs', `kill', and `wait' builtins now accept job control notation in their arguments even if job control is not enabled The `gettext' package and libintl have been integrated, and the shell messages may be translated into other languages Bash-2.05b introduced the following new features:
support for multibyte characters has been added to both bash and readline the DEBUG trap is now run *before* simple commands, ((...)) commands,
[[...]] conditional commands, and for ((...)) loopsthe shell now performs arithmetic in the largest integer size the machine supports (intmax_t) there is a new \D{...} prompt expansion; passes the `...' to strftime(3) and inserts the result into the expanded prompt there is a new `here-string' redirection operator: <<< word when displaying variables, function attributes and definitions are shown separately, allowing them to be re-used as input (attempting to re-use the old output would result in syntax errors). o `read' has a new `-u fd' option to read from a specified file descriptor
the bash debugger in examples/bashdb has been modified to work with the new DEBUG trap semantics, the command set has been made more gdb-like, and the changes to $LINENO make debugging functions work better the expansion of $LINENO inside a shell function is only relative to the function start if the shell is interactive -- if the shell is running a script, $LINENO expands to the line number in the script. This is as POSIX-2001 requires Bash-2.05a introduced the following new features:
The `printf' builtin has undergone major work There is a new read-only `shopt' option: login_shell, which is set by login shells and unset otherwise New `\A' prompt string escape sequence; expanding to time in 24-hour HH:MM format New `-A group/-g' option to complete and compgen; goes group name completion New [+-]O invocation option to set and unset `shopt' options at startup ksh-like `ERR' trap o `for' loops now allow empty word lists after the `in' reserved word
new `hard' and `soft' arguments for the `ulimit' builtin Readline can be configured to place the user at the same point on the line when retrieving commands from the history list Readline can be configured to skip `hidden' files (filenames with a leading `.' on Unix) when performing completion Bash-2.05 introduced the following new features:
This version has once again reverted to using locales and strcoll(3) when processing pattern matching bracket expressions, as POSIX requires. Added a new `--init-file' invocation argument as a synonym for `--rcfile', per the new GNU coding standards. The /dev/tcp and /dev/udp redirections now accept service names as well as port numbers.<li>`complete' and `compgen' now take a `-o value' option, which controls some of the aspects of that compspec. Valid values are: default - perform bash default completion if programmable completion produces no matches dirnames - perform directory name completion if programmable completion produces no matches filenames - tell readline that the compspec produces filenames, so it can do things like append slashes to directory names and suppress trailing spaces
A new loadable builtin, realpath, which canonicalizes and expands symlinks in pathname arguments. When `set' is called without options, it prints function defintions in a way that allows them to be reused as input. This affects `declare' and `declare -p' as well. This only happens when the shell is not in POSIX mode, since POSIX.2 forbids this behavior. Bash-2.04 introduced the following new features:
Programmable word completion with the new `complete' and `compgen' builtins; examples are provided in examples/complete/complete-examples `history' has a new `-d' option to delete a history entry `bind' has a new `-x' option to bind key sequences to shell commands The prompt expansion code has new `\j' and `\l' escape sequences The `no_empty_cmd_completion' shell option, if enabled, inhibits command completion when TAB is typed on an empty line `help' has a new `-s' option to print a usage synopsis New arithmetic operators: var++, var--, ++var, --var, expr1,expr2 (comma) New ksh93-style arithmetic for command: for ((expr1 ; expr2; expr3 )); do list; done<li>`read' has new options: `-t', `-n', `-d', `-s' The redirection code handles several filenames specially: /dev/fd/N, /dev/stdin, /dev/stdout, /dev/stderr The redirection code now recognizes /dev/tcp/HOST/PORT and /dev/udp/HOST/PORT and tries to open a TCP or UDP socket, respectively, to the specified port on the specified host The ${!prefix*} expansion has been implemented A new FUNCNAME variable, which expands to the name of a currently-executing function The GROUPS variable is no longer readonly A new shopt `xpg_echo' variable, to control the behavior of echo with respect to backslash-escape sequences at runtime The NON_INTERACTIVE_LOGIN_SHELLS #define has returned The version of Readline released with Bash-2.04, Readline-4.1, had several new features as well:
Parentheses matching is always compiled into readline, and controllable with the new `blink-matching-paren' variable The history-search-forward and history-search-backward functions now leave point at the end of the line when the search string is empty, like reverse-search-history, and forward-search-history A new function for applications: rl_on_new_line_with_prompt() New variables for applications: rl_already_prompted, and rl_gnu_readline_p Bash-2.03 had very few new features, in keeping with the convention that odd-numbered releases provide mainly bug fixes. A number of new features were added to Readline, mostly at the request of the Cygnus folks.
A new shopt option, `restricted_shell', so that startup files can test whether or not the shell was started in restricted mode Filename generation is now performed on the words between ( and ) in compound array assignments (this is really a bug fix) OLDPWD is now auto-exported, as POSIX.2 requires ENV and BASH_ENV are read-only variables in a restricted shell Bash may now be linked against an already-installed Readline library, as long as the Readline library is version 4 or newer All shells begun with the `--login' option will source the login shell startup files, even if the shell is not interactive
There were lots of changes to the version of the Readline library released along with Bash-2.03. For a complete list of the changes, read the file CHANGES in the Bash-2.03 distribution.
Bash-2.02 contained the following new features:
a new version of malloc (based on the old GNU malloc code in previous bash versions) that is more page-oriented, more conservative with memory usage, does not `orphan' large blocks when they are freed, is usable on 64-bit machines, and has allocation checking turned on unconditionally POSIX.2-style globbing character classes ([:alpha:], [:alnum:], etc.) POSIX.2-style globbing equivalence classes POSIX.2-style globbing collating symbols the ksh [[...]] extended conditional command the ksh egrep-style extended pattern matching operators a new `printf' builtin the ksh-like $(<filename) command substitution, which is equivalent to $(cat filename) new tilde prefixes that expand to directories from the directory stack new `**' arithmetic operator to do exponentiation case-insensitive globbing (filename expansion) menu completion a la tcsh `magic-space' history expansion function like tcsh the readline inputrc `language' has a new file inclusion directive ($include)
Bash-2.01 contained only a few new features:
new `GROUPS' builtin array variable containing the user's group list new bindable readline commands: history-and-alias-expand-line and alias-expand-line
Bash-2.0 contained extensive changes and new features from bash-1.14.7. Here's a short list:
new `time' reserved word to time pipelines, shell builtins, and shell functions one-dimensional arrays with a new compound assignment statement, appropriate expansion constructs and modifications to some of the builtins (read, declare, etc.) to use them new quoting syntaxes for ANSI-C string expansion and locale-specific string translation new expansions to do substring extraction, pattern replacement, and indirect variable expansion new builtins: `disown' and `shopt' new variables: HISTIGNORE, SHELLOPTS, PIPESTATUS, DIRSTACK, GLOBIGNORE, MACHTYPE, BASH_VERSINFO special handling of many unused or redundant variables removed (e.g., $notify, $glob_dot_filenames, $no_exit_on_failed_exec) dynamic loading of new builtin commands; many loadable examples provided new prompt expansions: \a, \e, \n, \H, \T, \@, \v, \V history and aliases available in shell scripts new readline variables: enable-keypad, mark-directories, input-meta, visible-stats, disable-completion, comment-begin new readline commands to manipulate the mark and operate on the region new readline emacs mode commands and bindings for ksh-88 compatibility updated and extended builtins new DEBUG trap expanded (and now documented) restricted shell mode
implementation stuff: autoconf-based configuration nearly all of the bugs reported since version 1.14 have been fixed most builtins converted to use builtin `getopt' for consistency most builtins use -p option to display output in a reusable form (for consistency) grammar tighter and smaller (66 reduce-reduce conflicts gone) lots of code now smaller and faster test suite greatly expanded
B2) Are there any user-visible incompatibilities between bash-3.2 and bash-2.05b?
There are a few incompatibilities between version 2.05b and version 3.2. They are detailed in the file COMPAT in the bash distribution. That file is not meant to be all-encompassing; send mail to bash-maintain...@gnu.org if if you find something that's not mentioned there.
Last modified: March 12, 2019