1 This document details the incompatibilites between this version of bash,
2 bash-2.05, and the previous widely-available version, bash-1.14 (which
3 is still the `standard' version for many Linux distributions). These
4 were discovered by users of bash-2.x, so this list is not comprehensive.
6 1. Bash now uses a new quoting syntax, $"...", to do locale-specific
7 string translation. Users who have relied on the (undocumented)
8 behavior of bash-1.14 will have to change their scripts. For
9 instance, if you are doing something like this to get the value of
10 a variable whose name is the value of a second variable:
14 you will have to change to a different syntax.
16 This capability is directly supported by bash-2.0:
20 This alternate syntax will work portably between bash-1.14 and bash-2.0:
24 2. One of the bugs fixed in the YACC grammar tightens up the rules
25 concerning group commands ( {...} ). The `list' that composes the
26 body of the group command must be terminated by a newline or
27 semicolon. That's because the braces are reserved words, and are
28 recognized as such only when a reserved word is legal. This means
29 that while bash-1.14 accepted shell function definitions like this:
33 bash-2.0 requires this:
37 This is also an issue for commands like this:
39 mkdir dir || { echo 'could not mkdir' ; exit 1; }
41 The syntax required by bash-2.0 is also accepted by bash-1.14.
43 3. The options to `bind' have changed to make them more consistent with
44 the rest of the bash builtins. If you are using `bind -d' to list
45 the readline keybindings in a form that can be re-read, use `bind -p'
46 instead. If you were using `bind -v' to list the keybindings, use
49 4. The `long' invocation options must now be prefixed by `--' instead
50 of `-'. (The old form is still accepted, for the time being.)
52 5. There was a bug in the version of readline distributed with bash-1.14
53 that caused it to write badly-formatted key bindings when using
54 `bind -d'. The only key sequences that were affected are C-\ (which
55 should appear as \C-\\ in a key binding) and C-" (which should appear
56 as \C-\"). If these key sequences appear in your inputrc, as, for
61 they will need to be changed to something like the following:
65 6. A number of people complained above having to use ESC to terminate an
66 incremental search, and asked for an alternate mechanism. Bash-2.03
67 uses the value of the settable readline variable `isearch-terminators'
68 to decide which characters should terminate an incremental search. If
69 that variable has not been set, ESC and Control-J will terminate a
72 7. Some variables have been removed: MAIL_WARNING, notify, history_control,
73 command_oriented_history, glob_dot_filenames, allow_null_glob_expansion,
74 nolinks, hostname_completion_file, noclobber, no_exit_on_failed_exec, and
75 cdable_vars. Most of them are now implemented with the new `shopt'
76 builtin; others were already implemented by `set'. Here is a list of
79 MAIL_WARNING shopt mailwarn
81 history_control HISTCONTROL
82 command_oriented_history shopt cmdhist
83 glob_dot_filenames shopt dotglob
84 allow_null_glob_expansion shopt nullglob
85 nolinks set -o physical
86 hostname_completion_file HOSTFILE
87 noclobber set -o noclobber
88 no_exit_on_failed_exec shopt execfail
89 cdable_vars shopt cdable_vars
91 8. `ulimit' now sets both hard and soft limits and reports the soft limit
92 by default (when neither -H nor -S is specified). This is compatible
93 with versions of sh and ksh that implement `ulimit'. The bash-1.14
94 behavior of, for example,
102 It may be useful to define an alias:
104 alias ulimit="ulimit -S"
106 9. Bash-2.01 uses a new quoting syntax, $'...' to do ANSI-C string
107 translation. Backslash-escaped characters in ... are expanded and
108 replaced as specified by the ANSI C standard.
110 10. The sourcing of startup files has changed somewhat. This is explained
111 more completely in the INVOCATION section of the manual page.
113 A non-interactive shell not named `sh' and not in posix mode reads
114 and executes commands from the file named by $BASH_ENV. A
115 non-interactive shell started by `su' and not in posix mode will read
116 startup files. No other non-interactive shells read any startup files.
118 An interactive shell started in posix mode reads and executes commands
119 from the file named by $ENV.
121 11. The <> redirection operator was changed to conform to the POSIX.2 spec.
122 In the absence of any file descriptor specification preceding the `<>',
123 file descriptor 0 is used. In bash-1.14, this was the behavior only
124 when in POSIX mode. The bash-1.14 behavior may be obtained with
128 12. The `alias' builtin now checks for invalid options and takes a `-p'
129 option to display output in POSIX mode. If you have old aliases beginning
130 with `-' or `+', you will have to add the `--' to the alias command
133 alias -x='chmod a-x' --> alias -- -x='chmod a-x'
135 13. There was a bug in bash-1.14 and previous versions that caused it to
136 accept as valid syntax for loops of the form
138 for f in ; do ... ; done
140 This should be a syntax error, and bash-2.x treats it as such.
142 14. The behavior of range specificiers within bracket matching expressions
143 in the pattern matcher (e.g., [A-Z]) depends on the current locale,
144 specifically the value of the LC_COLLATE environment variable. Setting
145 this variable to C or POSIX will result in the traditional ASCII behavior
146 for range comparisons. If the locale is set to something else, e.g.,
147 en_US (specified by the LANG or LC_ALL variables), collation order is
148 locale-dependent. For example, the en_US locale sorts the upper and
149 lower case letters like this:
153 so a range specification like [A-Z] will match every letter except `z'.
155 The portable way to specify upper case letters is [:upper:] instead of
156 A-Z; lower case may be specified as [:lower:] instead of a-z.
158 Look at the manual pages for setlocale(3), strcoll(3), and, if it is
161 You can find your current locale information by running locale(1):
163 caleb.ins.cwru.edu(2)$ locale
177 into /etc/profile and inspect any shell scripts run from cron for
178 constructs like [A-Z]. This will prevent things like
182 from removing every file in the current directory except those beginning
183 with `z' and still allow individual users to change the collation order.
184 Users may put the above command into their own profiles as well, of course.
186 15. Bash versions up to 1.14.7 included an undocumented `-l' operator to
187 the `test/[' builtin. It was a unary operator that expanded to the
188 length of its string argument. This let you do things like
190 test -l $variable -lt 20
194 This was included for backwards compatibility with old versions of the
195 Bourne shell, which did not provide an easy way to obtain the length of
196 the value of a shell variable.
198 This operator is not part of the POSIX standard, because one can (and
199 should) use ${#variable} to get the length of a variable's value.
200 Bash-2.x does not support it.