1 This is a terse description of the new features added to bash-3.0 since
2 the release of bash-2.05b. As always, the manual page (doc/bash.1) is
3 the place to look for complete descriptions.
5 1. New Features in Bash
7 a. ANSI string expansion now implements the \x{hexdigits} escape.
9 b. There is a new loadable `strftime' builtin.
11 c. New variable, COMP_WORDBREAKS, which controls the readline completer's
12 idea of word break characters.
14 d. The `type' builtin no longer reports on aliases unless alias expansion
15 will actually be performed.
17 e. HISTCONTROL is now a colon-separated list of values, which permits
18 more extensibility and backwards compatibility.
20 f. HISTCONTROL may now include the `erasedups' option, which causes all lines
21 matching a line being added to be removed from the history list.
23 g. `configure' has a new `--enable-multibyte' argument that permits multibyte
24 character support to be disabled even on systems that support it.
26 h. New variables to support the bash debugger: BASH_ARGC, BASH_ARGV,
27 BASH_SOURCE, BASH_LINENO, BASH_SUBSHELL, BASH_EXECUTION_STRING,
30 i. FUNCNAME has been changed to support the debugger: it's now an array
33 j. for, case, select, arithmetic commands now keep line number information
36 k. There is a new `RETURN' trap executed when a function or sourced script
37 returns (not inherited child processes; inherited by command substitution
38 if function tracing is enabled and the debugger is active).
40 l. New invocation option: --debugger. Enables debugging and turns on new
41 `extdebug' shell option.
43 m. New `functrace' and `errtrace' options to `set -o' cause DEBUG and ERR
44 traps, respectively, to be inherited by shell functions. Equivalent to
45 `set -T' and `set -E' respectively. The `functrace' option also controls
46 whether or not the DEBUG trap is inherited by sourced scripts.
48 n. The DEBUG trap is run before binding the variable and running the action
49 list in a `for' command, binding the selection variable and running the
50 query in a `select' command, and before attempting a match in a `case'
53 o. New `--enable-debugger' option to `configure' to compile in the debugger
56 p. `declare -F' now prints out extra line number and source file information
57 if the `extdebug' option is set.
59 q. If `extdebug' is enabled, a non-zero return value from a DEBUG trap causes
60 the next command to be skipped, and a return value of 2 while in a
61 function or sourced script forces a `return'.
63 r. New `caller' builtin to provide a call stack for the bash debugger.
65 s. The DEBUG trap is run just before the first command in a function body is
66 executed, for the debugger.
68 t. `for', `select', and `case' command heads are printed when `set -x' is
71 u. There is a new {x..y} brace expansion, which is shorthand for {x.x+1,
72 x+2,...,y}. x and y can be integers or single characters; the sequence
73 may ascend or descend; the increment is always 1.
75 v. New ksh93-like ${!array[@]} expansion, expands to all the keys (indices)
78 w. New `force_fignore' shopt option; if enabled, suffixes specified by
79 FIGNORE cause words to be ignored when performing word completion even
80 if they're the only possibilities.
82 x. New `gnu_errfmt' shopt option; if enabled, error messages follow the `gnu
83 style' (filename:lineno:message) format.
85 y. New `-o bashdefault' option to complete and compgen; if set, causes the
86 whole set of bash completions to be performed if the compspec doesn't
89 z. New `-o plusdirs' option to complete and compgen; if set, causes directory
90 name completion to be performed and the results added to the rest of the
93 aa. `kill' is available as a builtin even when the shell is built without
96 bb. New HISTTIMEFORMAT variable; value is a format string to pass to
97 strftime(3). If set and not null, the `history' builtin prints out
98 timestamp information according to the specified format when displaying
99 history entries. If set, bash tells the history library to write out
100 timestamp information when the history file is written.
102 cc. The [[ ... ]] command has a new binary `=~' operator that performs
103 extended regular expression (egrep-like) matching.
105 dd. `configure' has a new `--enable-cond-regexp' option (enabled by default)
106 to enable the =~ operator and regexp matching in [[ ... ]].
108 ee. Subexpressions matched by the =~ operator are placed in the new
109 BASH_REMATCH array variable.
111 ff. New `failglob' option that causes an expansion error when pathname
112 expansion fails to produce a match.
114 gg. New `set -o pipefail' option that causes a pipeline to return a failure
115 status if any of the processes in the pipeline fail, not just the last
118 hh. printf builtin understands two new escape sequences: \" and \?.
120 ii. `echo -e' understands two new escape sequences: \" and \?.
122 jj. The GNU `gettext' package and libintl have been integrated; the shell's
123 messages can be translated into different languages.
125 kk. The `\W' prompt expansion now abbreviates $HOME as `~', like `\w'.
127 ll. The error message printed when bash cannot open a shell script supplied
128 as argument 1 now includes the name of the shell, to better identify
129 the error as coming from bash.
131 mm. The parameter pattern removal and substitution expansions are now much
132 faster and more efficient when using multibyte characters.
134 nn. The `jobs', `kill', and `wait' builtins now accept job control notation
135 even if job control is not enabled.
137 oo. The historical behavior of `trap' that allows a missing `action' argument
138 to cause each specified signal's handling to be reset to its default is
139 now only supported when `trap' is given a single non-option argument.
141 2. New Features in Readline
143 a. History expansion has a new `a' modifier equivalent to the `g' modifier
144 for compatibility with the BSD csh.
146 b. History expansion has a new `G' modifier equivalent to the BSD csh `g'
147 modifier, which performs a substitution once per word.
149 c. All non-incremental search operations may now undo the operation of
150 replacing the current line with the history line.
152 d. The text inserted by an `a' command in vi mode can be reinserted with
155 e. New bindable variable, `show-all-if-unmodified'. If set, the readline
156 completer will list possible completions immediately if there is more
157 than one completion and partial completion cannot be performed.
159 f. There is a new application-callable `free_history_entry()' function.
161 g. History list entries now contain timestamp information; the history file
162 functions know how to read and write timestamp information associated
165 h. Four new key binding functions have been added:
167 rl_bind_key_if_unbound()
168 rl_bind_key_if_unbound_in_map()
169 rl_bind_keyseq_if_unbound()
170 rl_bind_keyseq_if_unbound_in_map()
172 i. New application variable, rl_completion_quote_character, set to any
173 quote character readline finds before it calls the application completion
176 j. New application variable, rl_completion_suppress_quote, settable by an
177 application completion function. If set to non-zero, readline does not
178 attempt to append a closing quote to a completed word.
180 k. New application variable, rl_completion_found_quote, set to a non-zero
181 value if readline determines that the word to be completed is quoted.
182 Set before readline calls any application completion function.
184 l. New function hook, rl_completion_word_break_hook, called when readline
185 needs to break a line into words when completion is attempted. Allows
186 the word break characters to vary based on position in the line.
188 m. New bindable command: unix-filename-rubout. Does the same thing as
189 unix-word-rubout, but adds `/' to the set of word delimiters.
191 n. When listing completions, directories have a `/' appended if the
192 `mark-directories' option has been enabled.
194 -------------------------------------------------------------------------------
195 This is a terse description of the new features added to bash-2.05b since
196 the release of bash-2.05a. As always, the manual page (doc/bash.1) is
197 the place to look for complete descriptions.
199 1. New Features in Bash
201 a. If set, TMOUT is the default timeout for the `read' builtin.
203 b. `type' has two new options: `-f' suppresses shell function lookup, and
204 `-P' forces a $PATH search.
206 c. New code to handle multibyte characters.
208 d. `select' was changed to be more ksh-compatible, in that the menu is
209 reprinted each time through the loop only if REPLY is set to NULL.
210 The previous behavior is available as a compile-time option.
212 e. `complete -d' and `complete -o dirnames' now force a slash to be
213 appended to names which are symlinks to directories.
215 f. There is now a bindable edit-and-execute-command readline command,
216 like the vi-mode `v' command, bound to C-xC-e in emacs mode.
218 g. Added support for ksh93-like [:word:] character class in pattern matching.
220 h. The $'...' quoting construct now expands \cX to Control-X.
222 i. A new \D{...} prompt expansion; passes the `...' to strftime and inserts
223 the result into the expanded prompt.
225 j. The shell now performs arithmetic in the largest integer size the
226 machine supports (intmax_t), instead of long.
228 k. If a numeric argument is supplied to one of the bash globbing completion
229 functions, a `*' is appended to the word before expansion is attempted.
231 l. The bash globbing completion functions now allow completions to be listed
232 with double tabs or if `show-all-if-ambiguous' is set.
234 m. New `-o nospace' option for `complete' and `compgen' builtins; suppresses
235 readline's appending a space to the completed word.
237 n. New `here-string' redirection operator: <<< word.
239 o. When displaying variables, function attributes and definitions are shown
240 separately, allowing them to be re-used as input (attempting to re-use
241 the old output would result in syntax errors).
243 p. There is a new configuration option `--enable-mem-scramble', controls
244 bash malloc behavior of writing garbage characters into memory at
245 allocation and free time.
247 q. The `complete' and `compgen' builtins now have a new `-s/-A service'
248 option to complete on names from /etc/services.
250 r. `read' has a new `-u fd' option to read from a specified file descriptor.
252 s. Fix the completion code so that expansion errors in a directory name
253 don't cause a longjmp back to the command loop.
255 t. Fixed word completion inside command substitution to work a little more
258 u. The `printf' %q format specifier now uses $'...' quoting to print the
259 argument if it contains non-printing characters.
261 v. The `declare' and `typeset' builtins have a new `-t' option. When applied
262 to functions, it causes the DEBUG trap to be inherited by the named
263 function. Currently has no effect on variables.
265 w. The DEBUG trap is now run *before* simple commands, ((...)) commands,
266 [[...]] conditional commands, and for ((...)) loops.
268 x. The expansion of $LINENO inside a shell function is only relative to the
269 function start if the shell is interactive -- if the shell is running a
270 script, $LINENO expands to the line number in the script. This is as
273 y. The bash debugger in examples/bashdb has been modified to work with the
274 new DEBUG trap semantics, the command set has been made more gdb-like,
275 and the changes to $LINENO make debugging functions work better. Code
278 z. New [n]<&word- and [n]>&word- redirections from ksh93 -- move fds (dup
281 aa. There is a new `-l' invocation option, equivalent to `--login'.
283 bb. The `hash' builtin has a new `-l' option to list contents in a reusable
284 format, and a `-d' option to remove a name from the hash table.
286 cc. There is now support for placing the long help text into separate files
287 installed into ${datadir}/bash. Not enabled by default; can be turned
288 on with `--enable-separate-helpfiles' option to configure.
290 dd. All builtins that take operands accept a `--' pseudo-option, except
293 ee. The `echo' builtin now accepts \0xxx (zero to three octal digits following
294 the `0') in addition to \xxx (one to three octal digits) for SUSv3/XPG6/
295 POSIX.1-2001 compliance.
298 2. New Features in Readline
300 a. Support for key `subsequences': allows, e.g., ESC and ESC-a to both
301 be bound to readline functions. Now the arrow keys may be used in vi
304 b. When listing completions, and the number of lines displayed is more than
305 the screen length, readline uses an internal pager to display the results.
306 This is controlled by the `page-completions' variable (default on).
308 c. New code to handle editing and displaying multibyte characters.
310 d. The behavior introduced in bash-2.05a of deciding whether or not to
311 append a slash to a completed name that is a symlink to a directory has
312 been made optional, controlled by the `mark-symlinked-directories'
313 variable (default is the 2.05a behavior).
315 e. The `insert-comment' command now acts as a toggle if given a numeric
316 argument: if the first characters on the line don't specify a
317 comment, insert one; if they do, delete the comment text
319 f. New application-settable completion variable:
320 rl_completion_mark_symlink_dirs, allows an application's completion
321 function to temporarily override the user's preference for appending
322 slashes to names which are symlinks to directories.
324 g. New function available to application completion functions:
325 rl_completion_mode, to tell how the completion function was invoked
326 and decide which argument to supply to rl_complete_internal (to list
329 h. Readline now has an overwrite mode, toggled by the `overwrite-mode'
330 bindable command, which could be bound to `Insert'.
332 i. New application-settable completion variable:
333 rl_completion_suppress_append, inhibits appending of
334 rl_completion_append_character to completed words.
336 j. New key bindings when reading an incremental search string: ^W yanks
337 the currently-matched word out of the current line into the search
338 string; ^Y yanks the rest of the current line into the search string,
339 DEL or ^H deletes characters from the search string.
341 -------------------------------------------------------------------------------
342 This is a terse description of the new features added to bash-2.05a since
343 the release of bash-2.05. As always, the manual page (doc/bash.1) is
344 the place to look for complete descriptions.
346 1. New Features in Bash
348 a. Added support for DESTDIR installation root prefix, so you can do a
349 `make install DESTDIR=bash-root' and do easier binary packaging.
351 b. Added support for builtin printf "'" flag character as per latest POSIX
354 c. Support for POSIX.2 printf(1) length specifiers `j', `t', and `z' (from
357 d. New autoconf macro, RL_LIB_READLINE_VERSION, for use by other applications
358 (bash doesn't use very much of what it returns).
360 e. `set [-+]o nolog' is recognized as required by the latest POSIX drafts,
363 f. New read-only `shopt' option: login_shell. Set to non-zero value if the
364 shell is a login shell.
366 g. New `\A' prompt string escape sequence; expands to time in 24 HH:MM format.
368 h. New `-A group/-g' option to complete and compgen; does group name
371 i. New `-t' option to `hash' to list hash values for each filename argument.
373 j. New [-+]O invocation option to set and unset `shopt' options at startup.
375 k. configure's `--with-installed-readline' option now takes an optional
376 `=PATH' suffix to set the root of the tree where readline is installed
379 l. The ksh-like `ERR' trap has been added. The `ERR' trap will be run
380 whenever the shell would have exited if the -e option were enabled.
381 It is not inherited by shell functions.
383 m. `readonly', `export', and `declare' now print variables which have been
384 given attributes but not set by assigning a value as just a command and
385 a variable name (like `export foo') when listing, as the latest POSIX
388 n. `bashbug' now requires that the subject be changed from the default.
390 o. configure has a new `--enable-largefile' option, like other GNU utilities.
392 p. `for' loops now allow empty word lists after `in', like the latest POSIX
395 q. The builtin `ulimit' now takes two new non-numeric arguments: `hard',
396 meaning the current hard limit, and `soft', meaning the current soft
397 limit, in addition to `unlimited'
399 r. `ulimit' now prints the option letter associated with a particular
400 resource when printing more than one limit.
402 s. `ulimit' prints `hard' or `soft' when a value is not `unlimited' but is
403 one of RLIM_SAVED_MAX or RLIM_SAVED_CUR, respectively.
405 t. The `printf' builtin now handles the %a and %A conversions if they're
406 implemented by printf(3).
408 u. The `printf' builtin now handles the %F conversion (just about like %f).
410 v. The `printf' builtin now handles the %n conversion like printf(3). The
411 corresponding argument is the name of a shell variable to which the
414 2. New Features in Readline
416 a. Added extern declaration for rl_get_termcap to readline.h, making it a
417 public function (it was always there, just not in readline.h).
419 b. New #defines in readline.h: RL_READLINE_VERSION, currently 0x0402,
420 RL_VERSION_MAJOR, currently 4, and RL_VERSION_MINOR, currently 2.
422 c. New readline variable: rl_readline_version, mirrors RL_READLINE_VERSION.
424 d. New bindable boolean readline variable: match-hidden-files. Controls
425 completion of files beginning with a `.' (on Unix). Enabled by default.
427 e. The history expansion code now allows any character to terminate a
428 `:first-' modifier, like csh.
430 f. New bindable variable `history-preserve-point'. If set, the history
431 code attempts to place the user at the same location on each history
432 line retrived with previous-history or next-history.
434 -------------------------------------------------------------------------------
435 This is a terse description of the new features added to bash-2.05 since
436 the release of bash-2.04. As always, the manual page (doc/bash.1) is
437 the place to look for complete descriptions.
439 1. New Features in Bash
441 a. Added a new `--init-file' invocation argument as a synonym for `--rcfile',
442 per the new GNU coding standards.
444 b. The /dev/tcp and /dev/udp redirections now accept service names as well as
447 c. `complete' and `compgen' now take a `-o value' option, which controls some
448 of the aspects of that compspec. Valid values are:
450 default - perform bash default completion if programmable
451 completion produces no matches
452 dirnames - perform directory name completion if programmable
453 completion produces no matches
454 filenames - tell readline that the compspec produces filenames,
455 so it can do things like append slashes to
456 directory names and suppress trailing spaces
458 d. A new loadable builtin, realpath, which canonicalizes and expands symlinks
459 in pathname arguments.
461 e. When `set' is called without options, it prints function defintions in a
462 way that allows them to be reused as input. This affects `declare' and
463 `declare -p' as well. This only happens when the shell is not in POSIX
464 mode, since POSIX.2 forbids this behavior.
466 f. Bash-2.05 once again honors the current locale setting when processing
467 ranges within pattern matching bracket expressions (e.g., [A-Z]).
469 2. New Features in Readline
471 a. The blink timeout for paren matching is now settable by applications,
472 via the rl_set_paren_blink_timeout() function.
474 b. _rl_executing_macro has been renamed to rl_executing_macro, which means
475 it's now part of the public interface.
477 c. Readline has a new variable, rl_readline_state, which is a bitmap that
478 encapsulates the current state of the library; intended for use by
479 callbacks and hook functions.
481 d. New application-callable function rl_set_prompt(const char *prompt):
482 expands its prompt string argument and sets rl_prompt to the result.
484 e. New application-callable function rl_set_screen_size(int rows, int cols):
485 public method for applications to set readline's idea of the screen
488 f. New function, rl_get_screen_size (int *rows, int *columns), returns
489 readline's idea of the screen dimensions.
491 g. The timeout in rl_gather_tyi (readline keyboard input polling function)
492 is now settable via a function (rl_set_keyboard_input_timeout()).
494 h. Renamed the max_input_history variable to history_max_entries; the old
495 variable is maintained for backwards compatibility.
497 i. The list of characters that separate words for the history tokenizer is
498 now settable with a variable: history_word_delimiters. The default
501 -------------------------------------------------------------------------------
502 This is a terse description of the new features added to bash-2.04 since
503 the release of bash-2.03. As always, the manual page (doc/bash.1) is
504 the place to look for complete descriptions.
506 1. New Features in Bash
508 a. The history builtin has a `-d offset' option to delete the history entry
509 at position `offset'.
511 b. The prompt expansion code has two new escape sequences: \j, the number of
512 active jobs; and \l, the basename of the shell's tty device name.
514 c. The `bind' builtin has a new `-x' option to bind key sequences to shell
517 d. There is a new shell option, no_empty_command_completion, which, when
518 enabled, disables command completion when TAB is typed on an empty line.
520 e. The `help' builtin has a `-s' option to just print a builtin's usage
523 f. There are several new arithmetic operators: id++, id-- (variable
524 post-increment/decrement), ++id, --id (variable pre-increment/decrement),
525 expr1 , expr2 (comma operator).
527 g. There is a new ksh-93 style arithmetic for command:
528 for ((expr1 ; expr2; expr3 )); do list; done
530 h. The `read' builtin has a number of new options:
531 -t timeout only wait timeout seconds for input
532 -n nchars only read nchars from input instead of a full line
533 -d delim read until delim rather than newline
534 -s don't echo input chars as they are read
536 i. The redirection code now handles several filenames specially:
537 /dev/fd/N, /dev/stdin, /dev/stdout, and /dev/stderr, whether or
538 not they are present in the file system.
540 j. The redirection code now recognizes pathnames of the form
541 /dev/tcp/host/port and /dev/udp/host/port, and tries to open a socket
542 of the appropriate type to the specified port on the specified host.
544 k. The ksh-93 ${!prefix*} expansion, which expands to the names of all
545 shell variables with prefix PREFIX, has been implemented.
547 l. There is a new dynamic variable, FUNCNAME, which expands to the name of
548 a currently-executing function. Assignments to FUNCNAME have no effect.
550 m. The GROUPS variable is no longer readonly; assignments to it are silently
551 discarded. This means it can be unset.
553 n. A new programmable completion facility, with two new builtin commands:
554 complete and compgen.
556 o. configure has a new option, `--enable-progcomp', to compile in the
557 programmable completion features (enabled by default).
559 p. `shopt' has a new option, `progcomp', to enable and disable programmable
560 completion at runtime.
562 q. Unsetting HOSTFILE now clears the list of hostnames used for completion.
564 r. configure has a new option, `--enable-bash-malloc', replacing the old
565 `--with-gnu-malloc' (which is still present for backwards compatibility).
567 s. There is a new manual page describing rbash, the restricted shell.
569 t. `bashbug' has new `--help' and `--version' options.
571 u. `shopt' has a new `xpg_echo' option, which controls the behavior of
572 `echo' with respect to backslash-escaped characters at runtime.
574 v. If NON_INTERACTIVE_LOGIN_SHELLS is defined, all login shells read the
575 startup files, even if they are not interactive.
577 w. The LC_NUMERIC variable is now treated specially, and used to set the
578 LC_NUMERIC locale category for number formatting, e.g., when `printf'
579 displays floating-point numbers.
581 2. New features in Readline
583 a. Parentheses matching is now always compiled into readline, and enabled
584 or disabled when the value of the `blink-matching-paren' variable is
587 b. MS-DOS systems now use ~/_inputrc as the last-ditch inputrc filename.
589 c. MS-DOS systems now use ~/_history as the default history file.
591 d. history-search-{forward,backward} now leave the point at the end of the
592 line when the string to search for is empty, like
593 {reverse,forward}-search-history.
595 e. history-search-{forward,backward} now leave the last history line found
596 in the readline buffer if the second or subsequent search fails.
598 f. New function for use by applications: rl_on_new_line_with_prompt, used
599 when an application displays the prompt itself before calling readline().
601 g. New variable for use by applications: rl_already_prompted. An application
602 that displays the prompt itself before calling readline() must set this to
605 h. A new variable, rl_gnu_readline_p, always 1. The intent is that an
606 application can verify whether or not it is linked with the `real'
607 readline library or some substitute.
609 -------------------------------------------------------------------------------
610 This is a terse description of the new features added to bash-2.03 since
611 the release of bash-2.02. As always, the manual page (doc/bash.1) is
612 the place to look for complete descriptions.
614 1. New Features in Bash
616 a. New `shopt' option, `restricted_shell', indicating whether or not the
617 shell was started in restricted mode, for use in startup files.
619 b. Filename generation is now performed on the words between ( and ) in
620 array assignments (which it probably should have done all along).
622 c. OLDPWD is now auto-exported, as POSIX.2 seems to require.
624 d. ENV and BASH_ENV are read-only variables in a restricted shell.
626 e. A change was made to the startup file code so that any shell begun with
627 the `--login' option, even non-interactive shells, will source the login
630 2. New Features in Readline
632 a. Many changes to the signal handling:
633 o Readline now catches SIGQUIT and cleans up the tty before returning;
634 o A new variable, rl_catch_signals, is available to application writers
635 to indicate to readline whether or not it should install its own
636 signal handlers for SIGINT, SIGTERM, SIGQUIT, SIGALRM, SIGTSTP,
637 SIGTTIN, and SIGTTOU;
638 o A new variable, rl_catch_sigwinch, is available to application
639 writers to indicate to readline whether or not it should install its
640 own signal handler for SIGWINCH, which will chain to the calling
641 applications's SIGWINCH handler, if one is installed;
642 o There is a new function, rl_free_line_state, for application signal
643 handlers to call to free up the state associated with the current
644 line after receiving a signal;
645 o There is a new function, rl_cleanup_after_signal, to clean up the
646 display and terminal state after receiving a signal;
647 o There is a new function, rl_reset_after_signal, to reinitialize the
648 terminal and display state after an application signal handler
649 returns and readline continues
651 b. There is a new function, rl_resize_terminal, to reset readline's idea of
652 the screen size after a SIGWINCH.
654 c. New public functions: rl_save_prompt and rl_restore_prompt. These were
655 previously private functions with a `_' prefix.
657 d. New function hook: rl_pre_input_hook, called just before readline starts
658 reading input, after initialization.
660 e. New function hook: rl_display_matches_hook, called when readline would
661 display the list of completion matches. The new function
662 rl_display_match_list is what readline uses internally, and is available
663 for use by application functions called via this hook.
665 f. New bindable function, delete-char-or-list, like tcsh.
667 g. A new variable, rl_erase_empty_line, which, if set by an application using
668 readline, will cause readline to erase, prompt and all, lines on which the
669 only thing typed was a newline.
671 h. New bindable variable: `isearch-terminators'.
673 i. New bindable function: `forward-backward-delete-char' (unbound by default).
675 -------------------------------------------------------------------------------
676 This is a terse description of the new features added to bash-2.02 since
677 the release of bash-2.01.1. As always, the manual page (doc/bash.1) is
678 the place to look for complete descriptions.
680 1. New Features in Bash
682 a. A new version of malloc, based on the older GNU malloc, that has many
683 changes, is more page-based, is more conservative with memory usage,
684 and does not `orphan' large blocks when they are freed.
686 b. A new version of gmalloc, based on the old GLIBC malloc, with many
687 changes and range checking included by default.
689 c. A new implementation of fnmatch(3) that includes full POSIX.2 Basic
690 Regular Expression matching, including character classes, collating
691 symbols, equivalence classes, and support for case-insensitive pattern
694 d. ksh-88 egrep-style extended pattern matching ([@+*?!](patlist)) has been
695 implemented, controlled by a new `shopt' option, `extglob'.
697 e. There is a new ksh-like `[[' compound command, which implements
698 extended `test' functionality.
700 f. There is a new `printf' builtin, implemented according to the POSIX.2
703 g. There is a new feature for command substitution: $(< filename) now expands
704 to the contents of `filename', with any trailing newlines removed
705 (equivalent to $(cat filename)).
707 h. There are new tilde prefixes which expand to directories from the
710 i. There is a new `**' arithmetic operator to do exponentiation.
712 j. There are new configuration options to control how bash is linked:
713 `--enable-profiling', to allow bash to be profiled with gprof, and
714 `--enable-static-link', to allow bash to be linked statically.
716 k. There is a new configuration option, `--enable-cond-command', which
717 controls whether or not the `[[' command is included. It is on by
720 l. There is a new configuration option, `--enable-extended-glob', which
721 controls whether or not the ksh extended globbing feature is included.
722 It is enabled by default.
724 m. There is a new configuration #define in config.h.top that, when enabled,
725 will cause all login shells to source /etc/profile and one of the user-
726 specific login shell startup files, whether or not the shell is
729 n. There is a new invocation option, `--dump-po-strings', to dump
730 a shell script's translatable strings ($"...") in GNU `po' format.
732 o. There is a new `shopt' option, `nocaseglob', to enable case-insensitive
733 pattern matching when globbing filenames and using the `case' construct.
735 p. There is a new `shopt' option, `huponexit', which, when enabled, causes
736 the shell to send SIGHUP to all jobs when an interactive login shell
739 q. `bind' has a new `-u' option, which takes a readline function name as an
740 argument and unbinds all key sequences bound to that function in a
743 r. `disown' now has `-a' and `-r' options, to limit operation to all jobs
744 and running jobs, respectively.
746 s. The `shopt' `-p' option now causes output to be displayed in a reusable
749 t. `test' has a new `-N' option, which returns true if the filename argument
750 has been modified since it was last accessed.
752 u. `umask' now has a `-p' option to print output in a reusable format.
754 v. A new escape sequence, `\xNNN', has been added to the `echo -e' and $'...'
755 translation code. It expands to the character whose ascii code is NNN
758 w. The prompt string expansion code has a new `\r' escape sequence.
760 x. The shell may now be cross-compiled for the CYGWIN32 environment on
763 2. New Features in Readline
765 a. There is now an option for `iterative' yank-last-arg handline, so a user
766 can keep entering `M-.', yanking the last argument of successive history
769 b. New variable, `print-completions-horizontally', which causes completion
770 matches to be displayed across the screen (like `ls -x') rather than up
771 and down the screen (like `ls').
773 c. New variable, `completion-ignore-case', which causes filename completion
774 and matching to be performed case-insensitively.
776 d. There is a new bindable command, `magic-space', which causes history
777 expansion to be performed on the current readline buffer and a space to
778 be inserted into the result.
780 e. There is a new bindable command, `menu-complete', which enables tcsh-like
781 menu completion (successive executions of menu-complete insert a single
782 completion match, cycling through the list of possible completions).
784 f. There is a new bindable command, `paste-from-clipboard', for use on Win32
785 systems, to insert the text from the Win32 clipboard into the editing
788 g. The key sequence translation code now understands printf-style backslash
789 escape sequences, including \NNN octal escapes. These escape sequences
790 may be used in key sequence definitions or macro values.
792 h. An `$include' inputrc file parser directive has been added.
794 -------------------------------------------------------------------------------
795 This is a terse description of the new features added to bash-2.01 since
796 the release of bash-2.0. As always, the manual page (doc/bash.1) is the
797 place to look for complete descriptions.
799 1. New Features in Bash
801 a. There is a new builtin array variable: GROUPS, the set of groups to which
802 the user belongs. This is used by the test suite.
804 2. New Features in Readline
806 a. If a key sequence bound to `universal-argument' is read while reading a
807 numeric argument started with `universal-argument', it terminates the
808 argument but is otherwise ignored. This provides a way to insert multiple
809 instances of a digit string, and is how GNU emacs does it.
811 -------------------------------------------------------------------------------
812 This is a terse description of the new features added to bash-2.0 since
813 the release of bash-1.14.7. As always, the manual page (doc/bash.1) is
814 the place to look for complete descriptions.
816 1. New Features in Bash
818 a. There is a new invocation option, -D, that dumps translatable strings
821 b. The `long' invocation options must now be prefixed with `--'.
823 c. New long invocation options: --dump-strings, --help, --verbose
825 d. The `nolineediting' invocation option was renamed to `noediting'.
827 e. The `nobraceexpansion' and `quiet' long invocation options were removed.
829 f. The `--help' and `--version' long options now work as the GNU coding
832 g. If invoked as `sh', bash now enters posix mode after reading the
833 startup files, and reads and executes commands from the file named
834 by $ENV if interactive (as POSIX.2 specifies). A login shell invoked
835 as `sh' reads $ENV after /etc/profile and ~/.profile.
837 h. There is a new reserved word, `time', for timing pipelines, builtin
838 commands, and shell functions. It uses the value of the TIMEFORMAT
839 variable as a format string describing how to print the timing
842 i. The $'...' quoting syntax expands ANSI-C escapes in ... and leaves the
843 result single-quoted.
845 j. The $"..." quoting syntax performs locale-specific translation of ...
846 and leaves the result double-quoted.
848 k. LINENO now works correctly in functions.
850 l. New variables: DIRSTACK, PIPESTATUS, BASH_VERSINFO, HOSTNAME, SHELLOPTS,
851 MACHTYPE. The first three are array variables.
853 m. The BASH_VERSION and BASH_VERSINFO variables now include the shell's
854 `release status' (alpha[N], beta[N], release).
856 n. Some variables have been removed: MAIL_WARNING, notify, history_control,
857 command_oriented_history, glob_dot_filenames, allow_null_glob_expansion,
858 nolinks, hostname_completion_file, noclobber, no_exit_on_failed_exec, and
859 cdable_vars. Most of them are now implemented with the new `shopt'
860 builtin; others were already implemented by `set'.
862 o. Bash now uses some new variables: LC_ALL, LC_MESSAGES, LC_CTYPE,
863 LC_COLLATE, LANG, GLOBIGNORE, HISTIGNORE.
865 p. The shell now supports integer-indexed arrays of unlimited length,
866 with a new compound assignment syntax and changes to the appropriate
867 builtin commands (declare/typeset, read, readonly, etc.). The array
868 index may be an arithmetic expression.
870 q. ${!var}: indirect variable expansion, equivalent to eval \${$var}.
872 r. ${paramter:offset[:length]}: variable substring extraction.
874 s. ${parameter/pattern[/[/]string]}: variable pattern substitution.
876 t. The $[...] arithmetic expansion syntax is no longer supported, in
879 u. Aliases can now be expanded in shell scripts with a shell option
880 (shopt expand_aliases).
882 v. History and history expansion can now be used in scripts with
883 set -o history and set -H.
885 w. All builtins now return an exit status of 2 for incorrect usage.
887 x. Interactive shells resend SIGHUP to all running or stopped children
888 if (and only if) they exit due to a SIGHUP.
890 y. New prompting expansions: \a, \e, \H, \T, \@, \v, \V.
892 z. Variable expansion in prompt strings is now controllable via a shell
893 option (shopt promptvars).
895 aa. Bash now defaults to using command-oriented history.
897 bb. The history file ($HISTFILE) is now truncated to $HISTFILESIZE after
900 cc. The POSIX.2 conditional arithmetic evaluation syntax (expr ? expr : expr)
901 has been implemented.
903 dd. Each builtin now accepts `--' to signify the end of the options, except
904 as documented (echo, etc.).
906 ee. All builtins use -p to display values in a re-readable format where
907 appropriate, except as documented (echo, type, etc.).
909 ff. The `alias' builtin has a new -p option.
911 gg. Changes to the `bind' builtin:
912 o has new options: -psPSVr.
913 o the `-d' option was renamed to `-p'
914 o the `-v' option now dumps variables; the old `-v' is now `-P'
916 hh. The `bye' synonym for `exit' was removed.
918 ii. The -L and -P options to `cd' and `pwd' have been documented.
920 jj. The `cd' builtin now does spelling correction on the directory name
921 by default. This is settable with a shell option (shopt cdspell).
923 kk. The `declare' builtin has new options: -a, -F, -p.
925 ll. The `dirs' builtin has new options: -c, -p, -v.
927 mm. The new `disown' builtin removes jobs from the shell's jobs table
928 or inhibits the resending of SIGHUP when the shell receives a
931 nn. The `echo' builtin has a new escape character: \e.
933 oo. The `enable' builtin can now load new builtins dynamically from shared
934 objects on systems with the dlopen/dlsym interface. There are a number
935 of examples in the examples/loadables directory. There are also
936 new options: -d, -f, -s, -p.
938 pp. The `-all' option to `enable' was removed in favor of `-a'.
940 qq. The `exec' builtin has new options: -l, -c, -a.
942 rr. The `hash' builtin has a new option: -p.
944 ss. The `history' builtin has new options: -c, -p, -s.
946 tt. The `jobs' builtin has new options: -r, -s.
948 uu. The `kill' builtin has new options: -n signum, -l signame.
950 vv. The `pushd' and `popd' builtins have a new option: -n.
952 ww. The `read' builtin has new options: -p prompt, -e, -a.
954 xx. The `readonly' builtin has a new -a option, and the -n option was removed.
956 yy. Changes to the `set' builtin:
957 o new options: -B, -o keyword, -o onecmd, -o history
958 o options removed: -l, -d, -o nohash
959 o options changed: +o, -h, -o hashall
960 o now displays variables in a format that can be re-read as input
962 zz. The new `shopt' builtin controls shell optional behavior previously
963 done by setting and unsetting certain shell variables.
965 aaa. The `test' builtin has new operators: -o option, s1 == s2, s1 < s2,
966 and s1 > s2, where s1 and s2 are strings.
968 bbb. There is a new trap, DEBUG, executed after every simple command.
970 ccc. The `trap' builtin has a new -p option.
972 ddd. The `ulimit' builtin has a new -l option on 4.4BSD-based systems.
974 eee. The PS1, PS2, PATH, and IFS variables may now be unset.
976 fff. The restricted shell mode has been expanded and is now documented.
978 ggg. Security improvements:
979 o functions are not imported from the environment if running setuid
981 o no startup files are sourced if running setuid or with -p
983 hhh. The documentation has been overhauled: the texinfo manual was
984 expanded, and HTML versions of the man page and texinfo manual
987 iii. Changes to Posix mode:
988 o Command lookup now finds special builtins before shell functions.
989 o Failure of a special builtin causes a non-interactive shell to
990 exit. Failures are defined in the POSIX.2 specification.
991 o If the `cd' builtin finds a directory to change to using $CDPATH,
992 the value assigned to PWD when `cd' completes does not contain
994 o A non-interactive shell exits if a variable assignment error
995 occurs when no command name follows the assignment statements.
996 o A non-interactive shell exits if the interation variable in a
997 `for' statement or the selection variable in a `select' statement
998 is read-only or another variable assignment error occurs.
999 o The `<>' redirection operator now opens a file for both stdin and
1000 stdout by default, not just when in posix mode.
1001 o Assignment statements preceding special builtins now persist in
1002 the shell's environment when the builtin completes.
1004 Posix mode is now completely POSIX.2-compliant (modulo bugs). When
1005 invoked as sh, bash should be completely POSIX.2-compliant.
1007 jjj. The default value of PS1 is now "\s-\v\$ ".
1009 kkk. The ksh-like ((...)) arithmetic command syntax has been implemented.
1010 This is exactly equivalent to `let "..."'.
1012 lll. Integer constants have been extended to base 64.
1014 mmm. The `ulimit' builtin now sets both hard and soft limits and reports the
1015 soft limit by default.
1017 2. New Features in Readline
1019 a. New variables: enable-keypad, input-meta (new name for meta-flag),
1020 mark-directories, visible-stats (now documented), disable-completion,
1023 b. New bindable commands: kill-region, copy-region-as-kill,
1024 copy-backward-word, copy-forward-word, set-mark, exchange-point-and-mark,
1025 character-search, character-search-backward, insert-comment,
1026 glob-expand-word, glob-list-expansions, dump-variables, dump-macros.
1028 c. New emacs keybindings: delete-horizontal-space (M-\),
1029 insert-completions (M-*), possible-completions (M-=).
1031 d. The history-search-backward and history-search-forward commands were
1032 modified to be the same as previous-line and next-line if point is at
1033 the start of the line.
1035 e. More file types are available for the visible-stats mode.
1037 3. Changes of interest in the Bash implementation
1039 a. There is a new autoconf-based configuration mechanism.
1041 b. More things have been moved from Posix mode to standard shell behavior.
1043 c. The trace output (set -x) now inserts quotes where necessary so it can
1046 d. There is a compile-time option for a system-wide interactive shell
1047 startup file (disabled by default).
1049 e. The YACC grammar is smaller and tighter, and all 66 shift-reduce
1050 conflicts are gone. Several parsing bugs have been fixed.
1052 f. Builtin option parsing has been regularized (using internal_getopt()),
1053 with the exception of `echo', `type', and `set'.
1055 g. Builtins now return standard usage messages constructed from the
1056 `short doc' used by the help builtin.
1058 h. Completion now quotes using backslashes by default, but honors
1059 user-supplied quotes.
1061 i. The GNU libc malloc is available as a configure-time option.
1063 j. There are more internationalization features; bash uses gettext if
1064 it is available. The $"..." translation syntax uses the current
1067 k. There is better reporting of job termination when the shell is not
1070 l. The shell is somewhat more efficient: it uses a little less memory and
1071 makes fewer system calls.
1073 4. Changes of interest in the Readline implementation
1075 a. There is now support for readline `callback' functions.
1077 b. There is now support for user-supplied input, redisplay, and terminal
1078 preparation functions.
1080 c. Most of the shell-specific code in readline has been generalized or
1083 d. Most of the annoying redisplay bugs have been fixed, notably the problems
1084 with incremental search and excessive redrawing when special characters
1085 appear in the prompt string.
1087 e. There are new library functions and variables available to application
1088 writers, most having to do with completion and quoting.
1090 f. The NEWLINE character (^J) is now treated as a search terminator by the
1091 incremental search functions.