By Forrest Cook
February 25, 2009
On February 23, 2009 version 4.0 of the
BASH shell,
a.k.a. the Bourne-Again SHell, was
announced (see the initial LWN
article
for reader comments). For Linux users, at least those users who use the
command line, BASH and its associated built-in commands could easily
make up the most frequently run suite of Linux utilities.
The BASH version 4.0 release announcement states:
This is the fourth major release of bash.
This release fixes the remaining serious bugs in the bash version 3 branch
and introduces significant new features.
The most notable new features are associative arrays, improvements to the
programmable completion functionality, case-modifying word expansions,
co-processes, support for the '**' special glob pattern, and additions to
the shell syntax and redirections. The shell has been changed to be more
rigorous about parsing commands inside command substitutions, fixing one
piece of Posix non-compliance.
A long list of new capabilities have been added to BASH, here
are some of the highlights:
- The new autocd option causes bash to change to the directory that
is the first word in a command.
- The new checkjobs option makes BASH report running and stopped jobs when it exits.
- New shell variables include BASHPID (the BASH process ID), COMP_TYPE
(type of completion) and COMP_KEY (completion invocation character).
- BASH now supports a settable compatibility level for emulating older versions of the shell.
- New ulimit options are available for setting the socket buffer size and the number of threads.
- A new mapfile builtin can be used to populate an array with lines from a given file.
- Limited support has been added for completing command name words with globbing characters.
- The new globstar shell option allows ** to recursively match directories and files.
- The new dirspell shell option makes the filename completion code perform spelling correction on directory names.
- The read builtin's new -t option adds support for fractional timeout values.
- The new &>> redirection operator appends both standard output and standard error to a named file.
- Several new capabilities have been added to the case statement.
- New uppercase (^[^]) and lowercase (,[,]) case-modifying word expansions are available.
- Support has been added for associative array variables.
- A new coproc reserved word can specify a coprocess, which is an
asynchronous command run with two pipes connected to the creating shell.
- A long list of new readline capabilities have been added.
- Much more...
The latest version of BASH has acquired some of the advanced features
found in newer projects such as the
Z shell and the
Python language.
The user experience is enhanced and new capabilities are available
for those who write BASH scripts.
Hopefully the backwards-compatibility considerations have been adequately
dealt with.
BASH 4.0 shows that even an old dog can sometimes learn a few new tricks.
(
Log in to post comments)