BASH 4.0

maaxx's picture

A fost publicat BASH v. 4.0. Aceasta versiune repara multe buguri din versiunea 3 si aduce imbunatatiri semnificative:

This is a terse description of the new features added to bash-4.0 since
the release of bash-3.2. As always, the manual page (doc/bash.1) is
the place to look for complete descriptions.

1. New Features in Bash

a. When using substring expansion on the positional parameters, a starting
index of 0 now causes $0 to be prefixed to the list.

b. The `help' builtin now prints its columns with entries sorted vertically
rather than horizontally.

c. There is a new variable, $BASHPID, which always returns the process id of
the current shell.

d. There is a new `autocd' option that, when enabled, causes bash to attempt
to `cd' to a directory name that is supplied as the first word of a
simple command.

e. There is a new `checkjobs' option that causes the shell to check for and
report any running or stopped jobs at exit.

f. The programmable completion code exports a new COMP_TYPE variable, set to
a character describing the type of completion being attempted.

g. The programmable completion code exports a new COMP_KEY variable, set to
the character that caused the completion to be invoked (e.g., TAB).

h. If creation of a child process fails due to insufficient resources, bash
will try again several times before reporting failure.

i. The programmable completion code now uses the same set of characters as
readline when breaking the command line into a list of words.

j. The block multiplier for the ulimit -c and -f options is now 512 when in
Posix mode, as Posix specifies.

k. Changed the behavior of the read builtin to save any partial input received
in the specified variable when the read builtin times out. This also
results in variables specified as arguments to read to be set to the empty
string when there is no input available. When the read builtin times out,
it returns an exit status greater than 128.

l. The shell now has the notion of a `compatibility level', controlled by
new variables settable by `shopt'. Setting this variable currently
restores the bash-3.1 behavior when processing quoted strings on the rhs
of the `=~' operator to the `[[' command.

m. The `ulimit' builtin now has new -b (socket buffer size) and -T (number
of threads) options.

n. The -p option to `declare' now displays all variable values and attributes
(or function values and attributes if used with -f).

o. There is a new `compopt' builtin that allows completion functions to modify
completion options for existing completions or the completion currently
being executed.

p. The `read' builtin has a new -i option which inserts text into the reply
buffer when using readline.

q. A new `-E' option to the complete builtin allows control of the default
behavior for completion on an empty line.

r. There is now limited support for completing command name words containing
globbing characters.

s. Changed format of internal help documentation for all builtins to roughly
follow man page format.

t. The `help' builtin now has a new -d option, to display a short description,
and a -m option, to print help information in a man page-like format.

u. There is a new `mapfile' builtin to populate an array with lines from a
given file. The name `readarray' is a synonym.

v. If a command is not found, the shell attempts to execute a shell function
named `command_not_found_handle', supplying the command words as the
function arguments.

w. There is a new shell option: `globstar'. When enabled, the globbing code
treats `**' specially -- it matches all directories (and files within
them, when appropriate) recursively.

x. There is a new shell option: `dirspell'. When enabled, the filename
completion code performs spelling correction on directory names during

y. The `-t' option to the `read' builtin now supports fractional timeout

z. Brace expansion now allows zero-padding of expanded numeric values and
will add the proper number of zeroes to make sure all values contain the
same number of digits.

aa. There is a new bash-specific bindable readline function: `dabbrev-expand'.
It uses menu completion on a set of words taken from the history list.

bb. The command assigned to a key sequence with `bind -x' now sets two new
variables in the environment of the executed command: READLINE_LINE_BUFFER
and READLINE_POINT. The command can change the current readline line
and cursor position by modifying READLINE_LINE_BUFFER and READLINE_POINT,

cc. There is a new &>> redirection operator, which appends the standard output
and standard error to the named file.

dd. The parser now understands `|&' as a synonym for `2>&1 |', which redirects
the standard error for a command through a pipe.

ee. The new `;&' case statement action list terminator causes execution to
continue with the action associated with the next pattern in the
statement rather than terminating the command.

ff. The new `;;&' case statement action list terminator causes the shell to
test the next set of patterns after completing execution of the current
action, rather than terminating the command.

gg. The shell understands a new variable: PROMPT_DIRTRIM. When set to an
integer value greater than zero, prompt expansion of \w and \W will
retain only that number of trailing pathname components and replace
the intervening characters with `...'.

hh. There are new case-modifying word expansions: uppercase (^[^]) and
lowercase (,[,]). They can work on either the first character or
array element, or globally. They accept an optional shell pattern
that determines which characters to modify. There is an optionally-
configured feature to include capitalization operators.

ii. The shell provides associative array variables, with the appropriate
support to create, delete, assign values to, and expand them.

jj. The `declare' builtin now has new -l (convert value to lowercase upon
assignment) and -u (convert value to uppercase upon assignment) options.
There is an optionally-configurable -c option to capitalize a value at

kk. There is a new `coproc' reserved word that specifies a coprocess: an
asynchronous command run with two pipes connected to the creating shell.
Coprocs can be named. The input and output file descriptors and the
PID of the coprocess are available to the calling shell in variables
with coproc-specific names.

ll. A value of 0 for the -t option to `read' now returns success if there is
input available to be read from the specified file descriptor.

mm. CDPATH and GLOBIGNORE are ignored when the shell is running in privileged

nn. New bindable readline functions shell-forward-word and shell-backward-word,
which move forward and backward words delimited by shell metacharacters
and honor shell quoting.

oo. New bindable readline functions shell-backward-kill-word and shell-kill-word
which kill words backward and forward, but use the same word boundaries
as shell-forward-word and shell-backward-word.

2. New Features in Readline

a. A new variable, rl_sort_completion_matches; allows applications to inhibit
match list sorting (but beware: some things don't work right if
applications do this).

b. A new variable, rl_completion_invoking_key; allows applications to discover
the key that invoked rl_complete or rl_menu_complete.

c. The functions rl_block_sigint and rl_release_sigint are now public and
available to calling applications who want to protect critical sections
(like redisplay).

d. The functions rl_save_state and rl_restore_state are now public and
available to calling applications; documented rest of readline's state
flag values.

e. A new user-settable variable, `history-size', allows setting the maximum
number of entries in the history list.

f. There is a new implementation of menu completion, with several improvements
over the old; the most notable improvement is a better `completions
browsing' mode.

g. The menu completion code now uses the rl_menu_completion_entry_function
variable, allowing applications to provide their own menu completion

h. There is support for replacing a prefix of a pathname with a `...' when
displaying possible completions. This is controllable by setting the
`completion-prefix-display-length' variable. Matches with a common prefix
longer than this value have the common prefix replaced with `...'.

i. There is a new `revert-all-at-newline' variable. If enabled, readline will
undo all outstanding changes to all history lines when `accept-line' is

j. If the kernel supports it, readline displays special characters
corresponding to a keyboard-generated signal when the signal is received.

This is a terse description of the new features added to bash-3.2 since
the release of bash-3.1. As always, the manual page (doc/bash.1) is
the place to look for complete descriptions.

1. New Features in Bash

a. Changed the parameter pattern replacement functions to not anchor the
pattern at the beginning of the string if doing global replacement - that
combination doesn't make any sense.

b. When running in `word expansion only' mode (--wordexp option), inhibit
process substitution.

c. Loadable builtins now work on MacOS X 10.[34].

d. Shells running in posix mode no longer set $HOME, as POSIX requires.

e. The code that checks for binary files being executed as shell scripts now
checks only for NUL rather than any non-printing character.

f. Quoting the string argument to the [[ command's =~ operator now forces
string matching, as with the other pattern-matching operators.

2. New Features in Readline

a. Calling applications can now set the keyboard timeout to 0, allowing
poll-like behavior.

b. The value of SYS_INPUTRC (configurable at compilation time) is now used as
the default last-ditch startup file.

c. The history file reading functions now allow windows-like \r\n line

This is a terse description of the new features added to bash-3.1 since
the release of bash-3.0. As always, the manual page (doc/bash.1) is
the place to look for complete descriptions.

1. New Features in Bash

a. Bash now understands LC_TIME as a special variable so that time display
tracks the current locale.

b. BASH_ARGC, BASH_ARGV, BASH_SOURCE, and BASH_LINENO are no longer created
as `invisible' variables and may not be unset.

c. In POSIX mode, if `xpg_echo' option is enabled, the `echo' builtin doesn't
try to interpret any options at all, as POSIX requires.

d. The `bg' builtin now accepts multiple arguments, as POSIX seems to specify.

e. Fixed vi-mode word completion and glob expansion to perform tilde

f. The `**' mathematic exponentiation operator is now right-associative.

g. The `ulimit' builtin has new options: -i (max number of pending signals),
-q (max size of POSIX message queues), and -x (max number of file locks).

h. A bare `%' once again expands to the current job when used as a job

i. The `+=' assignment operator (append to the value of a string or array) is
now supported for assignment statements and arguments to builtin commands
that accept assignment statements.

j. BASH_COMMAND now preserves its value when a DEBUG trap is executed.

k. The `gnu_errfmt' option is enabled automatically if the shell is running
in an emacs terminal window.

l. New configuration option: --single-help-strings. Causes long help text
to be written as a single string; intended to ease translation.

m. The COMP_WORDBREAKS variable now causes the list of word break characters
to be emptied when the variable is unset.

n. An unquoted expansion of $* when $IFS is empty now causes the positional
parameters to be concatenated if the expansion doesn't undergo word

o. Bash now inherits $_ from the environment if it appears there at startup.

p. New shell option: nocasematch. If non-zero, shell pattern matching ignores
case when used by `case' and `[[' commands.

q. The `printf' builtin takes a new option: -v var. That causes the output
to be placed into var instead of on stdout.

r. By default, the shell no longer reports processes dying from SIGPIPE.

s. Bash now sets the extern variable `environ' to the export environment it
creates, so C library functions that call getenv() (and can't use the
shell-provided replacement) get current values of environment variables.

t. A new configuration option, `--enable-strict-posix-default', which will
build bash to be POSIX conforming by default.

u. If compiled for strict POSIX conformance, LINES and COLUMNS may now
override the true terminal size.

2. New Features in Readline

a. The key sequence sent by the keypad `delete' key is now automatically
bound to delete-char.

b. A negative argument to menu-complete now cycles backward through the
completion list.

c. A new bindable readline variable: bind-tty-special-chars. If non-zero,
readline will bind the terminal special characters to their readline
equivalents when it's called (on by default).

d. New bindable command: vi-rubout. Saves deleted text for possible
reinsertion, as with any vi-mode `text modification' command; `X' is bound
to this in vi command mode.

e. A new external application-controllable variable that allows the LINES
and COLUMNS environment variables to set the window size regardless of
what the kernel returns: rl_prefer_env_winsize

This is a terse description of the new features added to bash-3.0 since
the release of bash-2.05b. As always, the manual page (doc/bash.1) is
the place to look for complete descriptions.

1. New Features in Bash

a. ANSI string expansion now implements the \x{hexdigits} escape.

b. There is a new loadable `strftime' builtin.

c. New variable, COMP_WORDBREAKS, which controls the readline completer's
idea of word break characters.

d. The `type' builtin no longer reports on aliases unless alias expansion
will actually be performed.

e. HISTCONTROL is now a colon-separated list of values, which permits
more extensibility and backwards compatibility.

f. HISTCONTROL may now include the `erasedups' option, which causes all lines
matching a line being added to be removed from the history list.

g. `configure' has a new `--enable-multibyte' argument that permits multibyte
character support to be disabled even on systems that support it.

h. New variables to support the bash debugger: BASH_ARGC, BASH_ARGV,

i. FUNCNAME has been changed to support the debugger: it's now an array

j. for, case, select, arithmetic commands now keep line number information
for the debugger.

k. There is a new `RETURN' trap executed when a function or sourced script
returns (not inherited child processes; inherited by command substitution
if function tracing is enabled and the debugger is active).

l. New invocation option: --debugger. Enables debugging and turns on new
`extdebug' shell option.

m. New `functrace' and `errtrace' options to `set -o' cause DEBUG and ERR
traps, respectively, to be inherited by shell functions. Equivalent to
`set -T' and `set -E' respectively. The `functrace' option also controls
whether or not the DEBUG trap is inherited by sourced scripts.

n. The DEBUG trap is run before binding the variable and running the action
list in a `for' command, binding the selection variable and running the
query in a `select' command, and before attempting a match in a `case'

o. New `--enable-debugger' option to `configure' to compile in the debugger
support code.

p. `declare -F' now prints out extra line number and source file information
if the `extdebug' option is set.

q. If `extdebug' is enabled, a non-zero return value from a DEBUG trap causes
the next command to be skipped, and a return value of 2 while in a
function or sourced script forces a `return'.

r. New `caller' builtin to provide a call stack for the bash debugger.

s. The DEBUG trap is run just before the first command in a function body is
executed, for the debugger.

t. `for', `select', and `case' command heads are printed when `set -x' is

u. There is a new {x..y} brace expansion, which is shorthand for {x.x+1,
x+2,...,y}. x and y can be integers or single characters; the sequence
may ascend or descend; the increment is always 1.

v. New ksh93-like ${!array[@]} expansion, expands to all the keys (indices)
of array.

w. New `force_fignore' shopt option; if enabled, suffixes specified by
FIGNORE cause words to be ignored when performing word completion even
if they're the only possibilities.

x. New `gnu_errfmt' shopt option; if enabled, error messages follow the `gnu
style' (filename:lineno:message) format.

y. New `-o bashdefault' option to complete and compgen; if set, causes the
whole set of bash completions to be performed if the compspec doesn't
result in a match.

z. New `-o plusdirs' option to complete and compgen; if set, causes directory
name completion to be performed and the results added to the rest of the
possible completions.

aa. `kill' is available as a builtin even when the shell is built without
job control.

bb. New HISTTIMEFORMAT variable; value is a format string to pass to
strftime(3). If set and not null, the `history' builtin prints out
timestamp information according to the specified format when displaying
history entries. If set, bash tells the history library to write out
timestamp information when the history file is written.

cc. The [[ ... ]] command has a new binary `=~' operator that performs
extended regular expression (egrep-like) matching.

dd. `configure' has a new `--enable-cond-regexp' option (enabled by default)
to enable the =~ operator and regexp matching in [[ ... ]].

ee. Subexpressions matched by the =~ operator are placed in the new
BASH_REMATCH array variable.

ff. New `failglob' option that causes an expansion error when pathname
expansion fails to produce a match.

gg. New `set -o pipefail' option that causes a pipeline to return a failure
status if any of the processes in the pipeline fail, not just the last

hh. printf builtin understands two new escape sequences: \" and \?.

ii. `echo -e' understands two new escape sequences: \" and \?.

jj. The GNU `gettext' package and libintl have been integrated; the shell's
messages can be translated into different languages.

kk. The `\W' prompt expansion now abbreviates $HOME as `~', like `\w'.

ll. The error message printed when bash cannot open a shell script supplied
as argument 1 now includes the name of the shell, to better identify
the error as coming from bash.

mm. The parameter pattern removal and substitution expansions are now much
faster and more efficient when using multibyte characters.

nn. The `jobs', `kill', and `wait' builtins now accept job control notation
even if job control is not enabled.

oo. The historical behavior of `trap' that allows a missing `action' argument
to cause each specified signal's handling to be reset to its default is
now only supported when `trap' is given a single non-option argument.

2. New Features in Readline

a. History expansion has a new `a' modifier equivalent to the `g' modifier
for compatibility with the BSD csh.

b. History expansion has a new `G' modifier equivalent to the BSD csh `g'
modifier, which performs a substitution once per word.

c. All non-incremental search operations may now undo the operation of
replacing the current line with the history line.

d. The text inserted by an `a' command in vi mode can be reinserted with

e. New bindable variable, `show-all-if-unmodified'. If set, the readline
completer will list possible completions immediately if there is more
than one completion and partial completion cannot be performed.

f. There is a new application-callable `free_history_entry()' function.

g. History list entries now contain timestamp information; the history file
functions know how to read and write timestamp information associated
with each entry.

h. Four new key binding functions have been added:


i. New application variable, rl_completion_quote_character, set to any
quote character readline finds before it calls the application completion

j. New application variable, rl_completion_suppress_quote, settable by an
application completion function. If set to non-zero, readline does not
attempt to append a closing quote to a completed word.

k. New application variable, rl_completion_found_quote, set to a non-zero
value if readline determines that the word to be completed is quoted.
Set before readline calls any application completion function.

l. New function hook, rl_completion_word_break_hook, called when readline
needs to break a line into words when completion is attempted. Allows
the word break characters to vary based on position in the line.

m. New bindable command: unix-filename-rubout. Does the same thing as
unix-word-rubout, but adds `/' to the set of word delimiters.

n. When listing completions, directories have a `/' appended if the
`mark-directories' option has been enabled.

This is a terse description of the new features added to bash-2.05b since
the release of bash-2.05a. As always, the manual page (doc/bash.1) is
the place to look for complete descriptions.

1. New Features in Bash

a. If set, TMOUT is the default timeout for the `read' builtin.

b. `type' has two new options: `-f' suppresses shell function lookup, and
`-P' forces a $PATH search.

c. New code to handle multibyte characters.

d. `select' was changed to be more ksh-compatible, in that the menu is
reprinted each time through the loop only if REPLY is set to NULL.
The previous behavior is available as a compile-time option.

e. `complete -d' and `complete -o dirnames' now force a slash to be
appended to names which are symlinks to directories.

f. There is now a bindable edit-and-execute-command readline command,
like the vi-mode `v' command, bound to C-xC-e in emacs mode.

g. Added support for ksh93-like [:word:] character class in pattern matching.

h. The $'...' quoting construct now expands \cX to Control-X.

i. A new \D{...} prompt expansion; passes the `...' to strftime and inserts
the result into the expanded prompt.

j. The shell now performs arithmetic in the largest integer size the
machine supports (intmax_t), instead of long.

k. If a numeric argument is supplied to one of the bash globbing completion
functions, a `*' is appended to the word before expansion is attempted.

l. The bash globbing completion functions now allow completions to be listed
with double tabs or if `show-all-if-ambiguous' is set.

m. New `-o nospace' option for `complete' and `compgen' builtins; suppresses
readline's appending a space to the completed word.

n. New `here-string' redirection operator: <<< word.

o. 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).

p. There is a new configuration option `--enable-mem-scramble', controls
bash malloc behavior of writing garbage characters into memory at
allocation and free time.

q. The `complete' and `compgen' builtins now have a new `-s/-A service'
option to complete on names from /etc/services.

r. `read' has a new `-u fd' option to read from a specified file descriptor.

s. Fix the completion code so that expansion errors in a directory name
don't cause a longjmp back to the command loop.

t. Fixed word completion inside command substitution to work a little more

u. The `printf' %q format specifier now uses $'...' quoting to print the
argument if it contains non-printing characters.

v. The `declare' and `typeset' builtins have a new `-t' option. When applied
to functions, it causes the DEBUG trap to be inherited by the named
function. Currently has no effect on variables.

w. The DEBUG trap is now run *before* simple commands, ((...)) commands,
[[...]] conditional commands, and for ((...)) loops.

x. 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.

y. 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. Code
from Gary Vaughan.

z. New [n]<&word- and [n]>&word- redirections from ksh93 -- move fds (dup
and close).

aa. There is a new `-l' invocation option, equivalent to `--login'.

bb. The `hash' builtin has a new `-l' option to list contents in a reusable
format, and a `-d' option to remove a name from the hash table.

cc. There is now support for placing the long help text into separate files
installed into ${datadir}/bash. Not enabled by default; can be turned
on with `--enable-separate-helpfiles' option to configure.

dd. All builtins that take operands accept a `--' pseudo-option, except

ee. The `echo' builtin now accepts \0xxx (zero to three octal digits following
the `0') in addition to \xxx (one to three octal digits) for SUSv3/XPG6/
POSIX.1-2001 compliance.

2. New Features in Readline

a. Support for key `subsequences': allows, e.g., ESC and ESC-a to both
be bound to readline functions. Now the arrow keys may be used in vi
insert mode.

b. When listing completions, and the number of lines displayed is more than
the screen length, readline uses an internal pager to display the results.
This is controlled by the `page-completions' variable (default on).

c. New code to handle editing and displaying multibyte characters.

d. The behavior introduced in bash-2.05a of deciding whether or not to
append a slash to a completed name that is a symlink to a directory has
been made optional, controlled by the `mark-symlinked-directories'
variable (default is the 2.05a behavior).

e. The `insert-comment' command now acts as a toggle if given a numeric
argument: if the first characters on the line don't specify a
comment, insert one; if they do, delete the comment text

f. New application-settable completion variable:
rl_completion_mark_symlink_dirs, allows an application's completion
function to temporarily override the user's preference for appending
slashes to names which are symlinks to directories.

g. New function available to application completion functions:
rl_completion_mode, to tell how the completion function was invoked
and decide which argument to supply to rl_complete_internal (to list
completions, etc.).

h. Readline now has an overwrite mode, toggled by the `overwrite-mode'
bindable command, which could be bound to `Insert'.

i. New application-settable completion variable:
rl_completion_suppress_append, inhibits appending of
rl_completion_append_character to completed words.

j. New key bindings when reading an incremental search string: ^W yanks
the currently-matched word out of the current line into the search
string; ^Y yanks the rest of the current line into the search string,
DEL or ^H deletes characters from the search string.

This is a terse description of the new features added to bash-2.05a since
the release of bash-2.05. As always, the manual page (doc/bash.1) is
the place to look for complete descriptions.

1. New Features in Bash

a. Added support for DESTDIR installation root prefix, so you can do a
`make install DESTDIR=bash-root' and do easier binary packaging.

b. Added support for builtin printf "'" flag character as per latest POSIX

c. Support for POSIX.2 printf(1) length specifiers `j', `t', and `z' (from
ISO C99).

d. New autoconf macro, RL_LIB_READLINE_VERSION, for use by other applications
(bash doesn't use very much of what it returns).

e. `set [-+]o nolog' is recognized as required by the latest POSIX drafts,
but ignored.

f. New read-only `shopt' option: login_shell. Set to non-zero value if the
shell is a login shell.

g. New `\A' prompt string escape sequence; expands to time in 24 HH:MM format.

h. New `-A group/-g' option to complete and compgen; does group name

i. New `-t' option to `hash' to list hash values for each filename argument.

j. New [-+]O invocation option to set and unset `shopt' options at startup.

k. configure's `--with-installed-readline' option now takes an optional
`=PATH' suffix to set the root of the tree where readline is installed
to PATH.

l. The ksh-like `ERR' trap has been added. The `ERR' trap will be run
whenever the shell would have exited if the -e option were enabled.
It is not inherited by shell functions.

m. `readonly', `export', and `declare' now print variables which have been
given attributes but not set by assigning a value as just a command and
a variable name (like `export foo') when listing, as the latest POSIX
drafts require.

n. `bashbug' now requires that the subject be changed from the default.

o. configure has a new `--enable-largefile' option, like other GNU utilities.

p. `for' loops now allow empty word lists after `in', like the latest POSIX
drafts require.

q. The builtin `ulimit' now takes two new non-numeric arguments: `hard',
meaning the current hard limit, and `soft', meaning the current soft
limit, in addition to `unlimited'

r. `ulimit' now prints the option letter associated with a particular
resource when printing more than one limit.

s. `ulimit' prints `hard' or `soft' when a value is not `unlimited' but is
one of RLIM_SAVED_MAX or RLIM_SAVED_CUR, respectively.

t. The `printf' builtin now handles the %a and %A conversions if they're
implemented by printf(3).

u. The `printf' builtin now handles the %F conversion (just about like %f).

v. The `printf' builtin now handles the %n conversion like printf(3). The
corresponding argument is the name of a shell variable to which the
value is assigned.

2. New Features in Readline

a. Added extern declaration for rl_get_termcap to readline.h, making it a
public function (it was always there, just not in readline.h).

b. New #defines in readline.h: RL_READLINE_VERSION, currently 0x0402,
RL_VERSION_MAJOR, currently 4, and RL_VERSION_MINOR, currently 2.

c. New readline variable: rl_readline_version, mirrors RL_READLINE_VERSION.

d. New bindable boolean readline variable: match-hidden-files. Controls
completion of files beginning with a `.' (on Unix). Enabled by default.

e. The history expansion code now allows any character to terminate a
`:first-' modifier, like csh.

f. New bindable variable `history-preserve-point'. If set, the history
code attempts to place the user at the same location on each history
line retrived with previous-history or next-history.

This is a terse description of the new features added to bash-2.05 since
the release of bash-2.04. As always, the manual page (doc/bash.1) is
the place to look for complete descriptions.

1. New Features in Bash

a. Added a new `--init-file' invocation argument as a synonym for `--rcfile',
per the new GNU coding standards.

b. The /dev/tcp and /dev/udp redirections now accept service names as well as
port numbers.

c. `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

d. A new loadable builtin, realpath, which canonicalizes and expands symlinks
in pathname arguments.

e. 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.

f. Bash-2.05 once again honors the current locale setting when processing
ranges within pattern matching bracket expressions (e.g., [A-Z]).

2. New Features in Readline

a. The blink timeout for paren matching is now settable by applications,
via the rl_set_paren_blink_timeout() function.

b. _rl_executing_macro has been renamed to rl_executing_macro, which means
it's now part of the public interface.

c. Readline has a new variable, rl_readline_state, which is a bitmap that
encapsulates the current state of the library; intended for use by
callbacks and hook functions.

d. New application-callable function rl_set_prompt(const char *prompt):
expands its prompt string argument and sets rl_prompt to the result.

e. New application-callable function rl_set_screen_size(int rows, int cols):
public method for applications to set readline's idea of the screen

f. New function, rl_get_screen_size (int *rows, int *columns), returns
readline's idea of the screen dimensions.

g. The timeout in rl_gather_tyi (readline keyboard input polling function)
is now settable via a function (rl_set_keyboard_input_timeout()).

h. Renamed the max_input_history variable to history_max_entries; the old
variable is maintained for backwards compatibility.

i. The list of characters that separate words for the history tokenizer is
now settable with a variable: history_word_delimiters. The default
value is as before.

This is a terse description of the new features added to bash-2.04 since
the release of bash-2.03. As always, the manual page (doc/bash.1) is
the place to look for complete descriptions.

1. New Features in Bash

a. The history builtin has a `-d offset' option to delete the history entry
at position `offset'.

b. The prompt expansion code has two new escape sequences: \j, the number of
active jobs; and \l, the basename of the shell's tty device name.

c. The `bind' builtin has a new `-x' option to bind key sequences to shell

d. There is a new shell option, no_empty_command_completion, which, when
enabled, disables command completion when TAB is typed on an empty line.

e. The `help' builtin has a `-s' option to just print a builtin's usage

f. There are several new arithmetic operators: id++, id-- (variable
post-increment/decrement), ++id, --id (variable pre-increment/decrement),
expr1 , expr2 (comma operator).

g. There is a new ksh-93 style arithmetic for command:
for ((expr1 ; expr2; expr3 )); do list; done

h. The `read' builtin has a number of new options:
-t timeout only wait timeout seconds for input
-n nchars only read nchars from input instead of a full line
-d delim read until delim rather than newline
-s don't echo input chars as they are read

i. The redirection code now handles several filenames specially:
/dev/fd/N, /dev/stdin, /dev/stdout, and /dev/stderr, whether or
not they are present in the file system.

j. The redirection code now recognizes pathnames of the form
/dev/tcp/host/port and /dev/udp/host/port, and tries to open a socket
of the appropriate type to the specified port on the specified host.

k. The ksh-93 ${!prefix*} expansion, which expands to the names of all
shell variables with prefix PREFIX, has been implemented.

l. There is a new dynamic variable, FUNCNAME, which expands to the name of
a currently-executing function. Assignments to FUNCNAME have no effect.

m. The GROUPS variable is no longer readonly; assignments to it are silently
discarded. This means it can be unset.

n. A new programmable completion facility, with two new builtin commands:
complete and compgen.

o. configure has a new option, `--enable-progcomp', to compile in the
programmable completion features (enabled by default).

p. `shopt' has a new option, `progcomp', to enable and disable programmable
completion at runtime.

q. Unsetting HOSTFILE now clears the list of hostnames used for completion.

r. configure has a new option, `--enable-bash-malloc', replacing the old
`--with-gnu-malloc' (which is still present for backwards compatibility).

s. There is a new manual page describing rbash, the restricted shell.

t. `bashbug' has new `--help' and `--version' options.

u. `shopt' has a new `xpg_echo' option, which controls the behavior of
`echo' with respect to backslash-escaped characters at runtime.

v. If NON_INTERACTIVE_LOGIN_SHELLS is defined, all login shells read the
startup files, even if they are not interactive.

w. The LC_NUMERIC variable is now treated specially, and used to set the
LC_NUMERIC locale category for number formatting, e.g., when `printf'
displays floating-point numbers.

2. New features in Readline

a. Parentheses matching is now always compiled into readline, and enabled
or disabled when the value of the `blink-matching-paren' variable is

b. MS-DOS systems now use ~/_inputrc as the last-ditch inputrc filename.

c. MS-DOS systems now use ~/_history as the default history file.

d. history-search-{forward,backward} now leave the point at the end of the
line when the string to search for is empty, like

e. history-search-{forward,backward} now leave the last history line found
in the readline buffer if the second or subsequent search fails.

f. New function for use by applications: rl_on_new_line_with_prompt, used
when an application displays the prompt itself before calling readline().

g. New variable for use by applications: rl_already_prompted. An application
that displays the prompt itself before calling readline() must set this to
a non-zero value.

h. A new variable, rl_gnu_readline_p, always 1. The intent is that an
application can verify whether or not it is linked with the `real'
readline library or some substitute.

This is a terse description of the new features added to bash-2.03 since
the release of bash-2.02. As always, the manual page (doc/bash.1) is
the place to look for complete descriptions.

1. New Features in Bash

a. New `shopt' option, `restricted_shell', indicating whether or not the
shell was started in restricted mode, for use in startup files.

b. Filename generation is now performed on the words between ( and ) in
array assignments (which it probably should have done all along).

c. OLDPWD is now auto-exported, as POSIX.2 seems to require.

d. ENV and BASH_ENV are read-only variables in a restricted shell.

e. A change was made to the startup file code so that any shell begun with
the `--login' option, even non-interactive shells, will source the login
shell startup files.

2. New Features in Readline

a. Many changes to the signal handling:
o Readline now catches SIGQUIT and cleans up the tty before returning;
o A new variable, rl_catch_signals, is available to application writers
to indicate to readline whether or not it should install its own
o A new variable, rl_catch_sigwinch, is available to application
writers to indicate to readline whether or not it should install its
own signal handler for SIGWINCH, which will chain to the calling
applications's SIGWINCH handler, if one is installed;
o There is a new function, rl_free_line_state, for application signal
handlers to call to free up the state associated with the current
line after receiving a signal;
o There is a new function, rl_cleanup_after_signal, to clean up the
display and terminal state after receiving a signal;
o There is a new function, rl_reset_after_signal, to reinitialize the
terminal and display state after an application signal handler
returns and readline continues

b. There is a new function, rl_resize_terminal, to reset readline's idea of
the screen size after a SIGWINCH.

c. New public functions: rl_save_prompt and rl_restore_prompt. These were
previously private functions with a `_' prefix.

d. New function hook: rl_pre_input_hook, called just before readline starts
reading input, after initialization.

e. New function hook: rl_display_matches_hook, called when readline would
display the list of completion matches. The new function
rl_display_match_list is what readline uses internally, and is available
for use by application functions called via this hook.

f. New bindable function, delete-char-or-list, like tcsh.

g. A new variable, rl_erase_empty_line, which, if set by an application using
readline, will cause readline to erase, prompt and all, lines on which the
only thing typed was a newline.

h. New bindable variable: `isearch-terminators'.

i. New bindable function: `forward-backward-delete-char' (unbound by default).

This is a terse description of the new features added to bash-2.02 since
the release of bash-2.01.1. As always, the manual page (doc/bash.1) is
the place to look for complete descriptions.

1. New Features in Bash

a. A new version of malloc, based on the older GNU malloc, that has many
changes, is more page-based, is more conservative with memory usage,
and does not `orphan' large blocks when they are freed.

b. A new version of gmalloc, based on the old GLIBC malloc, with many
changes and range checking included by default.

c. A new implementation of fnmatch(3) that includes full POSIX.2 Basic
Regular Expression matching, including character classes, collating
symbols, equivalence classes, and support for case-insensitive pattern

d. ksh-88 egrep-style extended pattern matching ([@+*?!](patlist)) has been
implemented, controlled by a new `shopt' option, `extglob'.

e. There is a new ksh-like `[[' compound command, which implements
extended `test' functionality.

f. There is a new `printf' builtin, implemented according to the POSIX.2

g. There is a new feature for command substitution: $(< filename) now expands
to the contents of `filename', with any trailing newlines removed
(equivalent to $(cat filename)).

h. There are new tilde prefixes which expand to directories from the
directory stack.

i. There is a new `**' arithmetic operator to do exponentiation.

j. There are new configuration options to control how bash is linked:
`--enable-profiling', to allow bash to be profiled with gprof, and
`--enable-static-link', to allow bash to be linked statically.

k. There is a new configuration option, `--enable-cond-command', which
controls whether or not the `[[' command is included. It is on by

l. There is a new configuration option, `--enable-extended-glob', which
controls whether or not the ksh extended globbing feature is included.
It is enabled by default.

m. There is a new configuration #define in that, when enabled,
will cause all login shells to source /etc/profile and one of the user-
specific login shell startup files, whether or not the shell is

n. There is a new invocation option, `--dump-po-strings', to dump
a shell script's translatable strings ($"...") in GNU `po' format.

o. There is a new `shopt' option, `nocaseglob', to enable case-insensitive
pattern matching when globbing filenames and using the `case' construct.

p. There is a new `shopt' option, `huponexit', which, when enabled, causes
the shell to send SIGHUP to all jobs when an interactive login shell

q. `bind' has a new `-u' option, which takes a readline function name as an
argument and unbinds all key sequences bound to that function in a
specified keymap.

r. `disown' now has `-a' and `-r' options, to limit operation to all jobs
and running jobs, respectively.

s. The `shopt' `-p' option now causes output to be displayed in a reusable

t. `test' has a new `-N' option, which returns true if the filename argument
has been modified since it was last accessed.

u. `umask' now has a `-p' option to print output in a reusable format.

v. A new escape sequence, `\xNNN', has been added to the `echo -e' and $'...'
translation code. It expands to the character whose ascii code is NNN
in hexadecimal.

w. The prompt string expansion code has a new `\r' escape sequence.

x. The shell may now be cross-compiled for the CYGWIN32 environment on
a Unix machine.

2. New Features in Readline

a. There is now an option for `iterative' yank-last-arg handline, so a user
can keep entering `M-.', yanking the last argument of successive history

b. New variable, `print-completions-horizontally', which causes completion
matches to be displayed across the screen (like `ls -x') rather than up
and down the screen (like `ls').

c. New variable, `completion-ignore-case', which causes filename completion
and matching to be performed case-insensitively.

d. There is a new bindable command, `magic-space', which causes history
expansion to be performed on the current readline buffer and a space to
be inserted into the result.

e. There is a new bindable command, `menu-complete', which enables tcsh-like
menu completion (successive executions of menu-complete insert a single
completion match, cycling through the list of possible completions).

f. There is a new bindable command, `paste-from-clipboard', for use on Win32
systems, to insert the text from the Win32 clipboard into the editing

g. The key sequence translation code now understands printf-style backslash
escape sequences, including \NNN octal escapes. These escape sequences
may be used in key sequence definitions or macro values.

h. An `$include' inputrc file parser directive has been added.

This is a terse description of the new features added to bash-2.01 since
the release of bash-2.0. As always, the manual page (doc/bash.1) is the
place to look for complete descriptions.

1. New Features in Bash

a. There is a new builtin array variable: GROUPS, the set of groups to which
the user belongs. This is used by the test suite.

2. New Features in Readline

a. If a key sequence bound to `universal-argument' is read while reading a
numeric argument started with `universal-argument', it terminates the
argument but is otherwise ignored. This provides a way to insert multiple
instances of a digit string, and is how GNU emacs does it.

This is a terse description of the new features added to bash-2.0 since
the release of bash-1.14.7. As always, the manual page (doc/bash.1) is
the place to look for complete descriptions.

1. New Features in Bash

a. There is a new invocation option, -D, that dumps translatable strings
in a script.

b. The `long' invocation options must now be prefixed with `--'.

c. New long invocation options: --dump-strings, --help, --verbose

d. The `nolineediting' invocation option was renamed to `noediting'.

e. The `nobraceexpansion' and `quiet' long invocation options were removed.

f. The `--help' and `--version' long options now work as the GNU coding
standards specify.

g. If invoked as `sh', bash now enters posix mode after reading the
startup files, and reads and executes commands from the file named
by $ENV if interactive (as POSIX.2 specifies). A login shell invoked
as `sh' reads $ENV after /etc/profile and ~/.profile.

h. There is a new reserved word, `time', for timing pipelines, builtin
commands, and shell functions. It uses the value of the TIMEFORMAT
variable as a format string describing how to print the timing

i. The $'...' quoting syntax expands ANSI-C escapes in ... and leaves the
result single-quoted.

j. The $"..." quoting syntax performs locale-specific translation of ...
and leaves the result double-quoted.

k. LINENO now works correctly in functions.

MACHTYPE. The first three are array variables.

m. The BASH_VERSION and BASH_VERSINFO variables now include the shell's
`release status' (alpha[N], beta[N], release).

n. Some variables have been removed: MAIL_WARNING, notify, history_control,
command_oriented_history, glob_dot_filenames, allow_null_glob_expansion,
nolinks, hostname_completion_file, noclobber, no_exit_on_failed_exec, and
cdable_vars. Most of them are now implemented with the new `shopt'
builtin; others were already implemented by `set'.

o. Bash now uses some new variables: LC_ALL, LC_MESSAGES, LC_CTYPE,

p. The shell now supports integer-indexed arrays of unlimited length,
with a new compound assignment syntax and changes to the appropriate
builtin commands (declare/typeset, read, readonly, etc.). The array
index may be an arithmetic expression.

q. ${!var}: indirect variable expansion, equivalent to eval \${$var}.

r. ${paramter:offset[:length]}: variable substring extraction.

s. ${parameter/pattern[/[/]string]}: variable pattern substitution.

t. The $[...] arithmetic expansion syntax is no longer supported, in
favor of $((...)).

u. Aliases can now be expanded in shell scripts with a shell option
(shopt expand_aliases).

v. History and history expansion can now be used in scripts with
set -o history and set -H.

w. All builtins now return an exit status of 2 for incorrect usage.

x. Interactive shells resend SIGHUP to all running or stopped children
if (and only if) they exit due to a SIGHUP.

y. New prompting expansions: \a, \e, \H, \T, \@, \v, \V.

z. Variable expansion in prompt strings is now controllable via a shell
option (shopt promptvars).

aa. Bash now defaults to using command-oriented history.

bb. The history file ($HISTFILE) is now truncated to $HISTFILESIZE after
being written.

cc. The POSIX.2 conditional arithmetic evaluation syntax (expr ? expr : expr)
has been implemented.

dd. Each builtin now accepts `--' to signify the end of the options, except
as documented (echo, etc.).

ee. All builtins use -p to display values in a re-readable format where
appropriate, except as documented (echo, type, etc.).

ff. The `alias' builtin has a new -p option.

gg. Changes to the `bind' builtin:
o has new options: -psPSVr.
o the `-d' option was renamed to `-p'
o the `-v' option now dumps variables; the old `-v' is now `-P'

hh. The `bye' synonym for `exit' was removed.

ii. The -L and -P options to `cd' and `pwd' have been documented.

jj. The `cd' builtin now does spelling correction on the directory name
by default. This is settable with a shell option (shopt cdspell).

kk. The `declare' builtin has new options: -a, -F, -p.

ll. The `dirs' builtin has new options: -c, -p, -v.

mm. The new `disown' builtin removes jobs from the shell's jobs table
or inhibits the resending of SIGHUP when the shell receives a

nn. The `echo' builtin has a new escape character: \e.

oo. The `enable' builtin can now load new builtins dynamically from shared
objects on systems with the dlopen/dlsym interface. There are a number
of examples in the examples/loadables directory. There are also
new options: -d, -f, -s, -p.

pp. The `-all' option to `enable' was removed in favor of `-a'.

qq. The `exec' builtin has new options: -l, -c, -a.

rr. The `hash' builtin has a new option: -p.

ss. The `history' builtin has new options: -c, -p, -s.

tt. The `jobs' builtin has new options: -r, -s.

uu. The `kill' builtin has new options: -n signum, -l signame.

vv. The `pushd' and `popd' builtins have a new option: -n.

ww. The `read' builtin has new options: -p prompt, -e, -a.

xx. The `readonly' builtin has a new -a option, and the -n option was removed.

yy. Changes to the `set' builtin:
o new options: -B, -o keyword, -o onecmd, -o history
o options removed: -l, -d, -o nohash
o options changed: +o, -h, -o hashall
o now displays variables in a format that can be re-read as input

zz. The new `shopt' builtin controls shell optional behavior previously
done by setting and unsetting certain shell variables.

aaa. The `test' builtin has new operators: -o option, s1 == s2, s1 < s2,
and s1 > s2, where s1 and s2 are strings.

bbb. There is a new trap, DEBUG, executed after every simple command.

ccc. The `trap' builtin has a new -p option.

ddd. The `ulimit' builtin has a new -l option on 4.4BSD-based systems.

eee. The PS1, PS2, PATH, and IFS variables may now be unset.

fff. The restricted shell mode has been expanded and is now documented.

ggg. Security improvements:
o functions are not imported from the environment if running setuid
or with -p
o no startup files are sourced if running setuid or with -p

hhh. The documentation has been overhauled: the texinfo manual was
expanded, and HTML versions of the man page and texinfo manual
are included.

iii. Changes to Posix mode:
o Command lookup now finds special builtins before shell functions.
o Failure of a special builtin causes a non-interactive shell to
exit. Failures are defined in the POSIX.2 specification.
o If the `cd' builtin finds a directory to change to using $CDPATH,
the value assigned to PWD when `cd' completes does not contain
any symbolic links.
o A non-interactive shell exits if a variable assignment error
occurs when no command name follows the assignment statements.
o A non-interactive shell exits if the interation variable in a
`for' statement or the selection variable in a `select' statement
is read-only or another variable assignment error occurs.
o The `<>' redirection operator now opens a file for both stdin and
stdout by default, not just when in posix mode.
o Assignment statements preceding special builtins now persist in
the shell's environment when the builtin completes.

Posix mode is now completely POSIX.2-compliant (modulo bugs). When
invoked as sh, bash should be completely POSIX.2-compliant.

jjj. The default value of PS1 is now "\s-\v\$ ".

kkk. The ksh-like ((...)) arithmetic command syntax has been implemented.
This is exactly equivalent to `let "..."'.

lll. Integer constants have been extended to base 64.

mmm. The `ulimit' builtin now sets both hard and soft limits and reports the
soft limit by default.

2. New Features in Readline

a. New variables: enable-keypad, input-meta (new name for meta-flag),
mark-directories, visible-stats (now documented), disable-completion,

b. New bindable commands: kill-region, copy-region-as-kill,
copy-backward-word, copy-forward-word, set-mark, exchange-point-and-mark,
character-search, character-search-backward, insert-comment,
glob-expand-word, glob-list-expansions, dump-variables, dump-macros.

c. New emacs keybindings: delete-horizontal-space (M-\),
insert-completions (M-*), possible-completions (M-=).

d. The history-search-backward and history-search-forward commands were
modified to be the same as previous-line and next-line if point is at
the start of the line.

e. More file types are available for the visible-stats mode.

3. Changes of interest in the Bash implementation

a. There is a new autoconf-based configuration mechanism.

b. More things have been moved from Posix mode to standard shell behavior.

c. The trace output (set -x) now inserts quotes where necessary so it can
be reused as input.

d. There is a compile-time option for a system-wide interactive shell
startup file (disabled by default).

e. The YACC grammar is smaller and tighter, and all 66 shift-reduce
conflicts are gone. Several parsing bugs have been fixed.

f. Builtin option parsing has been regularized (using internal_getopt()),
with the exception of `echo', `type', and `set'.

g. Builtins now return standard usage messages constructed from the
`short doc' used by the help builtin.

h. Completion now quotes using backslashes by default, but honors
user-supplied quotes.

i. The GNU libc malloc is available as a configure-time option.

j. There are more internationalization features; bash uses gettext if
it is available. The $"..." translation syntax uses the current
locale and gettext.

k. There is better reporting of job termination when the shell is not

l. The shell is somewhat more efficient: it uses a little less memory and
makes fewer system calls.

4. Changes of interest in the Readline implementation

a. There is now support for readline `callback' functions.

b. There is now support for user-supplied input, redisplay, and terminal
preparation functions.

c. Most of the shell-specific code in readline has been generalized or

d. Most of the annoying redisplay bugs have been fixed, notably the problems
with incremental search and excessive redrawing when special characters
appear in the prompt string.

e. There are new library functions and variables available to application
writers, most having to do with completion and quoting.

f. The NEWLINE character (^J) is now treated as a search terminator by the
incremental search functions.