Imported from ../bash-2.05.tar.gz.

This commit is contained in:
Jari Aalto 2001-04-06 19:14:31 +00:00
commit 28ef6c316f
251 changed files with 22319 additions and 12413 deletions

220
doc/FAQ
View file

@ -1,4 +1,4 @@
This is the Bash FAQ, version 3.7, for Bash version 2.04.
This is the Bash FAQ, version 3.11, for Bash version 2.05.
This document contains a set of frequently-asked questions concerning
Bash, the GNU Bourne-Again Shell. Bash is a freely-available command
@ -36,8 +36,8 @@ A10) What is the bash `posix mode'?
Section B: The latest version
B1) What's new in version 2.04?
B2) Are there any user-visible incompatibilities between bash-2.04 and
B1) What's new in version 2.05?
B2) Are there any user-visible incompatibilities between bash-2.05 and
bash-1.14.7?
Section C: Differences from other Unix shells
@ -70,6 +70,10 @@ E5) I have a bunch of shell scripts that use backslash-escaped characters
in arguments to `echo'. Bash doesn't interpret these characters. Why
not, and how can I make it understand them?
E6) Why doesn't a while or for loop get suspended when I type ^Z?
E7) What about empty for loops in Makefiles?
E8) Why does the arithmetic evaluation code complain about `08'?
E9) Why does the pattern matching expression [A-Z]* match files beginning
with every letter except `z'?
Section F: Things to watch out for on certain Unix versions
@ -130,22 +134,22 @@ of Case Western Reserve University.
A2) What's the latest version?
The latest version is 2.04, first made available on Friday, 17 March 2000.
The latest version is 2.05, first made available on Monday, 9 April 2001.
A3) Where can I get it?
Bash is the GNU project's shell, and so is available from the
master GNU archive site, ftp.gnu.org, and its mirrors. The
latest version is also available for FTP from ftp.cwru.edu.
The following URLs tell how to get version 2.04:
The following URLs tell how to get version 2.05:
ftp://ftp.gnu.org/pub/gnu/bash/bash-2.04.tar.gz
ftp://ftp.cwru.edu/pub/bash/bash-2.04.tar.gz
ftp://ftp.gnu.org/pub/gnu/bash/bash-2.05.tar.gz
ftp://ftp.cwru.edu/pub/bash/bash-2.05.tar.gz
Formatted versions of the documentation are available with the URLs:
ftp://ftp.gnu.org/pub/gnu/bash/bash-doc-2.04.tar.gz
ftp://ftp.cwru.edu/pub/bash/bash-doc-2.04.tar.gz
ftp://ftp.gnu.org/pub/gnu/bash/bash-doc-2.05.tar.gz
ftp://ftp.cwru.edu/pub/bash/bash-doc-2.05.tar.gz
A4) On what machines will bash run?
@ -160,7 +164,7 @@ More information appears in the file `INSTALL' in the distribution.
A5) Will bash run on operating systems other than Unix?
Configuration specifics for Unix-like systems such as QNX and
LynxOS are included in the distribution. Bash-2.04 should
LynxOS are included in the distribution. Bash-2.05 should
compile and run on Minix 2.0 (patches were contributed), but I
don't believe anyone has built bash-2.x on earlier Minix versions
yet.
@ -168,16 +172,17 @@ yet.
Bash has been ported to versions of Windows implementing the Win32
programming interface. This includes Windows 95 and Windows NT.
The port was done by Cygnus Solutions as part of their CYGWIN
project. For more information about the project, look at the URL
project. For more information about the project, look at the URLs
http:/sourceware.cygnus.com/cygwin
http://www.cygwin.com/
http://sourceware.cygnus.com/cygwin
Cygnus originally ported bash-1.14.7, and that port was part of their
early GNU-Win32 (the original name) releases. Cygnus has also done a
port of bash-2.02.1 to the CYGWIN environment, and it is available as
part of their current release. (They may have upgraded by now.)
port of bash-2.04 to the CYGWIN environment, and it is available as
part of their current release.
Bash-2.04 should require no local Cygnus changes to build and run under
Bash-2.05 should require no local Cygnus changes to build and run under
CYGWIN.
The Cygnus port works only on Intel machines. There is a port of bash
@ -185,25 +190,13 @@ The Cygnus port works only on Intel machines. There is a port of bash
ftp://ftp.gnustep.org//pub/win32/bash-alpha-nt-1.01.tar.gz
Softway Systems has ported bash-2.01 to their Interix (nee OpenNT)
system, a Unix subsystem for NT that replaces the Microsoft POSIX
subsystem. Check out http://www.interix.com for more information.
Some support for Interix has been incorporated into bash, beginning
with Bash-2.03. It should be easier to build bash on Interix now,
but Interix users should fetch
ftp://ftp.interix.com/pub/tw/unsup/bash.diffs.tar.gz
and read the README.OpenNT file in that archive. It will detail the
arguments `configure' needs to build on Interix. A configure cache
file for Interix is in the bash distribution in cross-build/opennt.cache;
copy that to `config.cache' before starting configure.
D. J. Delorie has ported bash-1.14.7 to run under MS-DOS, as part of
the DJGPP project. For more information on the project, see
DJ Delorie has a port of bash-1.14.7 which runs under MS-DOS, as part
of the DJGPP project. For more information on the project, see
http://www.delorie.com/djgpp/
I have been told that the original DJGPP port was done by Daisuke Aoyama.
I picked up a binary of bash-1.14.7 that is purported to work with
the DJGPP V2 environment from
@ -374,18 +367,45 @@ Reference Manual.
Section B: The latest version
B1) What's new in version 2.04?
B1) What's new in version 2.05?
Bash-2.04 contains the following new features (see the manual page for
complete descriptions and the CHANGES and NEWS files in the bash-2.04
Bash-2.05 contains the following new features (see the manual page for
complete descriptions and the CHANGES and NEWS files in the bash-2.05
distribution):
o This version has once again reverted to using locales and strcoll(3) when
processing pattern matching bracket expressions, as POSIX requires.
o Added a new `--init-file' invocation argument as a synonym for `--rcfile',
per the new GNU coding standards.
o The /dev/tcp and /dev/udp redirections now accept service names as well as
port numbers.
o `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
o A new loadable builtin, realpath, which canonicalizes and expands symlinks
in pathname arguments.
o 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.
A short feature history dating from bash-2.0:
Bash-2.04 introduced the following new features:
o Programmable word completion with the new `complete' and `compgen' builtins;
examples are provided in examples/complete/complete-examples
o `history' has a new `-d' option to delete a history entry
o `bind' has a new `-x' option to bind key sequences to shell commands
o The prompt expansion code has new `\j' and `\l' escape sequences
o The `no_empty_command_completion' shell option, if enabled, inhibits
o The `no_empty_cmd_completion' shell option, if enabled, inhibits
command completion when TAB is typed on an empty line
o `help' has a new `-s' option to print a usage synopsis
o New arithmetic operators: var++, var--, ++var, --var, expr1,expr2 (comma)
@ -405,7 +425,7 @@ o A new shopt `xpg_echo' variable, to control the behavior of echo with
respect to backslash-escape sequences at runtime
o The NON_INTERACTIVE_LOGIN_SHELLS #define has returned
The version of Readline released with Bash-2.04, Readline-4.1, has several
The version of Readline released with Bash-2.04, Readline-4.1, had several
new features as well:
o Parentheses matching is always compiled into readline, and controllable
@ -417,8 +437,6 @@ o A new function for applications: rl_on_new_line_with_prompt()
o New variables for applications: rl_already_prompted, and rl_gnu_readline_p
A short feature history dating from bash-2.0:
Bash-2.03 had very few new features, in keeping with the convention
that odd-numbered releases provide mainly bug fixes. A number of new
features were added to Readline, mostly at the request of the Cygnus
@ -505,11 +523,11 @@ grammar tighter and smaller (66 reduce-reduce conflicts gone)
lots of code now smaller and faster
test suite greatly expanded
B2) Are there any user-visible incompatibilities between bash-2.04 and
B2) Are there any user-visible incompatibilities between bash-2.05 and
bash-1.14.7?
There are a few incompatibilities between version 1.14.7 and version 2.04.
They are detailed in the file COMPAT in the bash-2.04 distribution.
There are a few incompatibilities between version 1.14.7 and version 2.05.
They are detailed in the file COMPAT in the bash-2.05 distribution.
Section C: Differences from other Unix shells
@ -660,6 +678,7 @@ Things bash has or uses that ksh88 does not:
Things ksh88 has or uses that bash does not:
tracked aliases
variables: ERRNO, FPATH, EDITOR, VISUAL
trap on ERR
co-processes (|&, >&p, <&p)
weirdly-scoped functions
typeset +f to list all function names without definitions
@ -678,7 +697,7 @@ Implementation differences:
C3) Which new features in ksh-93 are not in bash, and which are?
New things in ksh-93 not in bash-2.04:
New things in ksh-93 not in bash-2.05:
associative arrays
floating point arithmetic
math library functions
@ -824,15 +843,15 @@ D4) How can I make my csh aliases work when I convert to bash?
Bash uses a different syntax to support aliases than csh does.
The details can be found in the documentation. We have provided
a shell script which does most of the work of conversion for you;
this script can be found in ./examples/misc/alias-conv.sh. Here is
this script can be found in ./examples/misc/aliasconv.sh. Here is
how you use it:
Start csh in the normal way for you. (e.g., `csh')
Pipe the output of `alias' through `alias-conv.sh', saving the
Pipe the output of `alias' through `aliasconv.sh', saving the
results into `bash_aliases':
alias | alias-conv.sh >bash_aliases
alias | bash aliasconv.sh >bash_aliases
Edit `bash_aliases', carefully reading through any created
functions. You will need to change the names of some csh specific
@ -967,7 +986,10 @@ E4) If I pipe the output of a command into `read variable', why doesn't
the output show up in $variable when the read command finishes?
This has to do with the parent-child relationship between Unix
processes.
processes. It affects all commands run in pipelines, not just
simple calls to `read'. For example, piping a command's output
into a `while' loop that repeatedly calls `read' will result in
the same behavior.
Each element of a pipeline runs in a separate process, a child of
the shell running the pipeline. A subprocess cannot affect its
@ -1058,6 +1080,100 @@ If you want to be able to stop the entire loop, you need to put it
within parentheses, which will force the loop into a subshell that
may be stopped (and subsequently restarted) as a single unit.
E7) What about empty for loops in Makefiles?
It's fairly common to see constructs like this in automatically-generated
Makefiles:
SUBDIRS = @SUBDIRS@
...
subdirs-clean:
for d in ${SUBDIRS}; do \
( cd $$d && ${MAKE} ${MFLAGS} clean ) \
done
When SUBDIRS is empty, this results in a command like this being passed to
bash:
for d in ; do
( cd $d && ${MAKE} ${MFLAGS} clean )
done
This is a syntax error. If the reserved word `in' is present, a word must
follow it before the semicolon or newline. The language in the manual page
referring to the list of words being empty refers to the list after it is
expanded. There must be at least one word following the `in' when the
construct is parsed.
The idiomatic Makefile solution is something like:
SUBDIRS = @SUBDIRS@
subdirs-clean:
subdirs=$SUBDIRS ; for d in $$subdirs; do \
( cd $$d && ${MAKE} ${MFLAGS} clean ) \
done
The POSIX.2 interpretation committee has considered this issue and declared
that the bash implemenation is correct, according to the standard:
http://www.pasc.org/interps/unofficial/db/p1003.2/pasc-1003.2-169.html
E8) Why does the arithmetic evaluation code complain about `08'?
The bash arithmetic evaluation code (used for `let', $(()), (()), and in
other places), interprets a leading `0' in numeric constants as denoting
an octal number, and a leading `0x' as denoting hexadecimal. This is
in accordance with the POSIX.2 spec, section 2.9.2.1, which states that
arithmetic constants should be handled as signed long integers as defined
by the ANSI/ISO C standard.
The POSIX.2 interpretation committee has confirmed this:
http://www.pasc.org/interps/unofficial/db/p1003.2/pasc-1003.2-173.html
E9) Why does the pattern matching expression [A-Z]* match files beginning
with every letter except `z'?
Bash-2.05 and later versions have reverted to the bash-2.03 behavior of
honoring the current locale setting when processing ranges within pattern
matching bracket expressions ([A-Z]). This is what POSIX.2 and SUSv2/XPG5
specify.
The behavior of the matcher in bash-2.05 depends on the current LC_COLLATE
setting. Setting this variable to `C' or `POSIX' will result in the
traditional behavior ([A-Z] matches all uppercase ASCII characters).
Many other locales, including the en_US locale (the default on many US
versions of Linux) collate the upper and lower case letters like this:
AaBb...Zz
which means that [A-Z] matches every letter except `z'.
The portable way to specify upper case letters is [:upper:] instead of
A-Z; lower case may be specified as [:lower:] instead of a-z.
Look at the manual pages for setlocale(3), strcoll(3), and, if it is
present, locale(1). If you have locale(1), you can use it to find
your current locale information even if you do not have any of the
LC_ variables set.
My advice is to put
export LC_COLLATE=C
into /etc/profile and inspect any shell scripts run from cron for
constructs like [A-Z]. This will prevent things like
rm [A-Z]*
from removing every file in the current directory except those beginning
with `z' and still allow individual users to change the collation order.
Users may put the above command into their own profiles as well, of course.
Section F: Things to watch out for on certain Unix versions
F1) Why can't I use command line editing in my `cmdtool'?
@ -1163,7 +1279,7 @@ comp.unix.shell). While most commands of the form
can be converted to `< file command', shell control structures such as
loops and subshells require `command < file'.
The file CWRU/sh-redir-hack in the bash-2.04 distribution is an
The file CWRU/sh-redir-hack in the bash-2.05 distribution is an
(unofficial) patch to parse.y that will modify the grammar to
support this construct. It will not apply with `patch'; you must
modify parse.y by hand. Note that if you apply this, you must
@ -1410,8 +1526,12 @@ H3) What's coming in future versions?
These are features I plan to include in a future version of bash.
a bash debugger (a minimally-tested version is included with bash-2.04)
a bash debugger (a minimally-tested version is included with bash-2.05)
associative arrays
changes to the DEBUG trap to be compatible with ksh93 (which runs the
trap before each simple command, instead of after each one like previous
versions)
an implementation of the ksh-like ERR trap
H4) What's on the bash `wish list' for future versions?
@ -1428,11 +1548,11 @@ a better loadable interface to perl with access to the shell builtins and
H5) When will the next release appear?
The next version will appear sometime in 2000 or 2001. Never make
The next version will appear sometime in 2001 or 2002. Never make
predictions.
This document is Copyright 1995-2000 by Chester Ramey.
This document is Copyright 1995-2001 by Chester Ramey.
Permission is hereby granted, without written agreement and
without license or royalty fees, to use, copy, and distribute