diff options
| author | Jari Aalto <jari.aalto@cante.net> | 1997-06-05 14:59:13 +0000 |
|---|---|---|
| committer | Jari Aalto <jari.aalto@cante.net> | 2009-09-12 16:46:50 +0000 |
| commit | d166f048818e10cf3799aa24a174fb22835f1acc (patch) | |
| tree | 1ca27f9243900f8b236d0cde6a3862002aea9e19 /doc | |
| parent | ccc6cda312fea9f0468ee65b8f368e9653e1380b (diff) | |
| download | android_external_bash-d166f048818e10cf3799aa24a174fb22835f1acc.tar.gz android_external_bash-d166f048818e10cf3799aa24a174fb22835f1acc.tar.bz2 android_external_bash-d166f048818e10cf3799aa24a174fb22835f1acc.zip | |
Imported from ../bash-2.01.tar.gz.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/FAQ | 262 | ||||
| -rw-r--r-- | doc/Makefile.in | 14 | ||||
| -rw-r--r-- | doc/bash.1 | 87 | ||||
| -rw-r--r-- | doc/bashref.info | 626 | ||||
| -rw-r--r-- | doc/bashref.texi | 290 | ||||
| -rw-r--r-- | doc/readline.3 | 17 |
6 files changed, 747 insertions, 549 deletions
@@ -1,4 +1,4 @@ -This is the Bash FAQ, version 2.1, for Bash version 2.0. +This is the Bash FAQ, version 2.5, for Bash version 2.01. This document contains a set of frequently-asked questions concerning Bash, the GNU Bourne-Again Shell. Bash is a freely-available command @@ -24,77 +24,78 @@ Section A: The Basics 2) What's the latest version? 3) Where can I get it? 4) On what machines will bash run? -5) How can I build bash with gcc? -6) How can I make bash my login shell? -7) I just changed my login shell to bash, and now I can't FTP into my +5) Will bash run on operating systems other than Unix? +6) How can I build bash with gcc? +7) How can I make bash my login shell? +8) I just changed my login shell to bash, and now I can't FTP into my machine. Why not? -8) What's the `POSIX 1003.2 standard'? -9) What is the bash `posix mode'? +9) What's the `POSIX 1003.2 standard'? +10) What is the bash `posix mode'? Section B: The latest version -10) What's new in version 2.0? -11) Are there any user-visible incompatibilities between bash-2.0 and +11) What's new in version 2.01? +12) Are there any user-visible incompatibilities between bash-2.01 and bash-1.14.7? Section C: Differences from other Unix shells -12) How does bash differ from sh, the Bourne shell? -13) How does bash differ from the Korn shell, version ksh88? -14) Which new features in ksh-93 are not in bash, and which are? +13) How does bash differ from sh, the Bourne shell? +14) How does bash differ from the Korn shell, version ksh88? +15) Which new features in ksh-93 are not in bash, and which are? Section D: Why does bash do some things differently than other Unix shells? -15) Why does bash run a different version of `command' than +16) Why does bash run a different version of `command' than `which command' says it will? -16) Why doesn't bash treat brace expansions exactly like csh? -17) Why doesn't bash have csh variable modifiers? -18) How can I make my csh aliases work when I convert to bash? -19) How can I pipe standard output and standard error from one command to +17) Why doesn't bash treat brace expansions exactly like csh? +18) Why doesn't bash have csh variable modifiers? +19) How can I make my csh aliases work when I convert to bash? +20) How can I pipe standard output and standard error from one command to another, like csh does with `|&'? -20) Now that I've converted from ksh to bash, are there equivalents to +21) Now that I've converted from ksh to bash, are there equivalents to ksh features like autoloaded functions and the `whence' command? Section E: How can I get bash to do certain things, and why does bash do things the way it does? -21) Why is the bash builtin `test' slightly different from /bin/test? -22) Why does bash sometimes say `Broken pipe'? -23) How can I get bash to read and display eight-bit characters? -24) How do I write a function `x' to replace builtin command `x', but +22) Why is the bash builtin `test' slightly different from /bin/test? +23) Why does bash sometimes say `Broken pipe'? +24) How can I get bash to read and display eight-bit characters? +25) How do I write a function `x' to replace builtin command `x', but still invoke the command from within the function? -25) When I have terminal escape sequences in my prompt, why does bash +26) When I have terminal escape sequences in my prompt, why does bash wrap lines at the wrong column? -26) How can I find the value of a shell variable whose name is the value +27) How can I find the value of a shell variable whose name is the value of another shell variable? -27) If I pipe the output of a command into `read variable', why doesn't +28) 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? -28) I have a bunch of shell scripts that use backslash-escaped characters +29) 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? -29) Why doesn't a while or for loop get suspended when I type ^Z? -30) How can I make the bash `time' reserved word print timing output that +30) Why doesn't a while or for loop get suspended when I type ^Z? +31) How can I make the bash `time' reserved word print timing output that looks like the output from my system's /usr/bin/time? Section F: Things to watch out for on certain Unix versions -31) Why can't I use command line editing in my `cmdtool'? -32) I built bash on Solaris 2. Why do globbing expansions and filename +32) Why can't I use command line editing in my `cmdtool'? +33) I built bash on Solaris 2. Why do globbing expansions and filename completion chop off the first few characters of each filename? -33) Why does bash dump core after I interrupt username completion or +34) Why does bash dump core after I interrupt username completion or `~user' tilde expansion on a machine running NIS? -34) I'm running SVR4.2. Why is the line erased every time I type `@'? -35) Why does bash report syntax errors when my C News scripts use a +35) I'm running SVR4.2. Why is the line erased every time I type `@'? +36) Why does bash report syntax errors when my C News scripts use a redirection before a subshell command? Section G: Where do I go from here? -36) How do I report bugs in bash, and where should I look for fixes and +37) How do I report bugs in bash, and where should I look for fixes and advice? -37) What kind of bash documentation is there? -38) What's coming in future versions? -39) What's on the bash `wish list'? -40) When will the next release appear? +38) What kind of bash documentation is there? +39) What's coming in future versions? +40) What's on the bash `wish list'? +41) When will the next release appear? ---------- Section A: The Basics @@ -119,7 +120,7 @@ of Case Western Reserve University. 2) What's the latest version? -The latest version is 2.0, first made available on December 23, 1996. +The latest version is 2.01, first made available on June 6, 1997. 3) Where can I get it? @@ -127,15 +128,15 @@ Bash is the GNU project's shell, and so is available from the master GNU archive site, prep.ai.mit.edu, and its mirrors. The latest version is also available for FTP from slc2.ins.cwru.edu, the maintainer's machine. The following URLs tell how to get -version 2.0: +version 2.01: -ftp://prep.ai.mit.edu/pub/gnu/bash-2.0.tar.gz -ftp://slc2.ins.cwru.edu/pub/dist/bash-2.0.tar.gz +ftp://prep.ai.mit.edu/pub/gnu/bash-2.01.tar.gz +ftp://slc2.ins.cwru.edu/pub/dist/bash-2.01.tar.gz Formatted versions of the documentation are available with the URLs: -ftp://prep.ai.mit.edu/pub/gnu/bash-doc-2.0.tar.gz -ftp://slc2.ins.cwru.edu/pub/dist/bash-doc-2.0.tar.gz +ftp://prep.ai.mit.edu/pub/gnu/bash-doc-2.01.tar.gz +ftp://slc2.ins.cwru.edu/pub/dist/bash-doc-2.01.tar.gz 4) On what machines will bash run? @@ -147,12 +148,49 @@ itself accordingly, using a script created by GNU autoconf. More information appears in the file `INSTALL' in the distribution. -5) How can I build bash with gcc? +5) 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. Previous versions of +bash have been ported to Minix, but I don't believe anyone has +built bash-2.x on Minix 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 GNU-Win32 +project. For more information about the project, look at the URL + +http://www.cygnus.com/misc/gnu-win32 + +Cygnus has ported bash-1.14.7. Maybe someday they (or I) will port +bash-2.01 (or later) to the GNU-Win32 environment. + +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 + +http://www.delorie.com/djgpp/ + +I picked up a binary of bash-1.14.7 that is purported to work with +the DJGPP V2 environment from + +ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/bsh1147b.zip + +The corresponding source is + +ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/bsh1147s.zip + +A port of bash-1.12 is available for OS/2 from + +ftp://hobbes.nmsu.edu/os2/unix/bash_112.zip + +I haven't looked at it. + +6) How can I build bash with gcc? Bash configures to use gcc by default if it is available. Read the file INSTALL in the distribution for more information. -6) How can I make bash my login shell? +7) How can I make bash my login shell? Some machines let you use `chsh' to change your login shell. Other systems use `passwd -s'. If one of these works for you, that's all @@ -182,18 +220,23 @@ like to ensure that bash is exec'd only when the csh is interactive. -If your login shell is sh or ksh, you have to do two things. First, add -a line similar to the above to ~/.profile: +If your login shell is sh or ksh, you have to do two things. - [ -f /usr/gnu/bin/bash ] && exec /usr/gnu/bin/bash --login - -Next, create an empty file in your home directory named `.bash_profile'. +First, create an empty file in your home directory named `.bash_profile'. The existence of this file will prevent the exec'd bash from trying to read ~/.profile, and re-execing itself over and over again. ~/.bash_profile -is the file bash tries to read initialization commands from when it is -invoked as a login shell. +is the first file bash tries to read initialization commands from when +it is invoked as a login shell. + +Next, add a line similar to the above to ~/.profile: + + [ -f /usr/gnu/bin/bash ] && exec /usr/gnu/bin/bash --login -7) I just changed my login shell to bash, and now I can't FTP into my +This will cause login shells to replace themselves with bash running as +a login shell. Once you have this working, you can copy your initialization +code from ~/.profile to ~/.bash_profile. + +8) I just changed my login shell to bash, and now I can't FTP into my machine. Why not? You must add the full pathname to bash to the file /etc/shells. As @@ -203,7 +246,7 @@ this before you can make bash your login shell. Most versions of ftpd use this file to prohibit `special' users such as `uucp' and `news' from using FTP. -8) What's the `POSIX 1003.2 standard'? +9) What's the `POSIX 1003.2 standard'? POSIX is a name originally coined by Richard Stallman for a family of open system standards based on UNIX. There are a @@ -238,7 +281,7 @@ line editing. Only vi-style line editing commands have been standardized; emacs editing commands were left out due to objections. -9) What is the bash `posix mode'? +10) What is the bash `posix mode'? Although bash is an implementation of the POSIX.2 shell specification, there are areas where the bash default behavior @@ -255,10 +298,16 @@ Reference Manual. Section B: The latest version -10) What's new in version 2.0? +11) What's new in version 2.01? + +Bash-2.01 contains only a few new features. + +new `GROUPS' builtin array variable containing the user's group list +new bindable readline commands: history-and-alias-expand-line and + alias-expand-line -This version contains extensive changes and new features. Here's a -short list: +Bash-2.0 contains extensive changes and new features from bash-1.14.7. +Here's a short list: new `time' reserved word to time pipelines, shell builtins, and shell functions @@ -295,15 +344,15 @@ grammar tighter and smaller (66 reduce-reduce conflicts gone) lots of code now smaller and faster test suite greatly expanded -11) Are there any user-visible incompatibilities between bash-2.0 and +12) Are there any user-visible incompatibilities between bash-2.01 and bash-1.14.7? -There are a few incompatibilities between version 1.14.7 and version 2.0. -They are detailed in the file COMPAT in the bash-2.0 distribution. +There are a few incompatibilities between version 1.14.7 and version 2.01. +They are detailed in the file COMPAT in the bash-2.01 distribution. Section C: Differences from other Unix shells -12) How does bash differ from sh, the Bourne shell? +13) How does bash differ from sh, the Bourne shell? This is a non-comprehensive list of features that differentiate bash from the SVR4.2 shell. The bash manual page explains these more @@ -370,7 +419,6 @@ Things sh has that bash does not: includes `stop' builtin (bash can use alias stop='kill -s STOP') `newgrp' builtin turns on job control if called as `jsh' - ulimit attempts to set both soft & hard limits if -S/-H not given $TIMEOUT (like bash $TMOUT) `^' is a synonym for `|' new SVR4.2 sh builtins: mldmode, priv @@ -386,11 +434,12 @@ Implementation differences: sh does not allow traps on SIGALRM or SIGCHLD bash allows multiple option arguments when invoked (e.g. -x -v); sh allows only a single option argument (`sh -x -v' attempts - to open a file named `-v', and, on SunOS 4.1.4, dumps core) + to open a file named `-v', and, on SunOS 4.1.4, dumps core. + On Solaris 2, sh goes into an infinite loop.) sh exits a script if any builtin fails; bash exits only if one of the POSIX.2 `special' builtins fails -13) How does bash differ from the Korn shell, version ksh88? +14) How does bash differ from the Korn shell, version ksh88? Things bash has or uses that ksh88 does not: long invocation options @@ -438,15 +487,14 @@ Things ksh88 has or uses that bash does not: Implementation differences: ksh runs last command of a pipeline in parent shell context - ksh ulimit sets hard and soft limits by default bash has brace expansion by default (ksh88 compile-time option) bash has fixed startup file for all interactive shells; ksh reads $ENV bash has exported functions bash command search finds functions before builtins -14) Which new features in ksh-93 are not in bash, and which are? +15) Which new features in ksh-93 are not in bash, and which are? -New things in ksh-93 not in bash-2.0: +New things in ksh-93 not in bash-2.01: associative arrays floating point arithmetic ++, --, comma arithmetic operators @@ -466,11 +514,10 @@ New things in ksh-93 not in bash-2.0: `fc' has been renamed to `hist' read -t/-d `.' can execute shell functions - ENV processed only for interactive shells -New things in ksh-93 present in bash-2.0: +New things in ksh-93 present in bash-2.01: ?: arithmetic operator - expansions: ${!param}, ${param:len[:offset]}, ${param/pat[/str]} + expansions: ${!param}, ${param:offset[:len]}, ${param/pat[/str]} compound array assignment the `!' reserved word loadable builtins -- but ksh uses `builtin' while bash uses `enable' @@ -488,10 +535,11 @@ New things in ksh-93 present in bash-2.0: unalias -a command and arithmetic substitution performed on PS1, PS4, and ENV command name completion + ENV processed only for interactive shells Section D: Why does bash do some things differently than other Unix shells? -15) Why does bash run a different version of `command' than +16) Why does bash run a different version of `command' than `which command' says it will? `which' is actually a csh script that assumes you're running csh. @@ -500,7 +548,7 @@ those to determine which `command' will be invoked. Since bash doesn't use any of those startup files, there's a good chance that your bash environment differs from your csh environment. -16) Why doesn't bash treat brace expansions exactly like csh? +17) Why doesn't bash treat brace expansions exactly like csh? The only difference between bash and csh brace expansion is that bash requires a brace expression to contain at least one unquoted @@ -511,7 +559,7 @@ compatibility. Bash, ksh, zsh, and pd-ksh all implement brace expansion this way. -17) Why doesn't bash have csh variable modifiers? +18) Why doesn't bash have csh variable modifiers? Posix has specified a more powerful, albeit somewhat more cryptic, mechanism cribbed from ksh, and bash implements it. @@ -566,7 +614,7 @@ Given $b:e ${b##*.} xxx -18) How can I make my csh aliases work when I convert to bash? +19) 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 @@ -609,7 +657,7 @@ simply `cshtobash' to convert your normal interactive environment, or as `cshtobash ~/.login' to convert your login environment. -19) How can I pipe standard output and standard error from one command to +20) How can I pipe standard output and standard error from one command to another, like csh does with `|&'? Use @@ -619,7 +667,7 @@ The key is to remember that piping is performed before redirection, so file descriptor 1 points to the pipe when it is duplicated onto file descriptor 2. -20) Now that I've converted from ksh to bash, are there equivalents to +21) Now that I've converted from ksh to bash, are there equivalents to ksh features like autoloaded functions and the `whence' command? There are features in ksh-88 that do not have direct bash equivalents. @@ -642,7 +690,7 @@ read var?prompt read -p prompt var Section E: How can I get bash to do certain things, and why does bash do things the way it does? -21) Why is the bash builtin `test' slightly different from /bin/test? +22) Why is the bash builtin `test' slightly different from /bin/test? The specific example used here is [ ! x -o x ], which is false. @@ -671,7 +719,7 @@ of the 3 Arg case. As you can see, the test becomes (not (x or x)), which is false. -22) Why does bash sometimes say `Broken pipe'? +23) Why does bash sometimes say `Broken pipe'? If a sequence of commands appears in a pipeline, and one of the reading commands finishes before the writer has finished, the @@ -686,7 +734,7 @@ will try to write on a pipe without a reader. In that case, bash will print `Broken pipe' to stderr when ps is killed by a SIGPIPE. -23) How can I get bash to read and display eight-bit characters? +24) How can I get bash to read and display eight-bit characters? This is a process requiring several steps. @@ -720,7 +768,7 @@ this. These variables can be set in your .inputrc or using the bash The `set' commands between the single quotes may also be placed in ~/.inputrc. -24) How do I write a function `x' to replace builtin command `x', but +25) How do I write a function `x' to replace builtin command `x', but still invoke the command from within the function? This is why the `command' and `builtin' builtins exist. The @@ -741,7 +789,7 @@ something like the following: This could also be written using `command' instead of `builtin'; the version above is marginally more efficient. -25) When I have terminal escape sequences in my prompt, why does bash +26) When I have terminal escape sequences in my prompt, why does bash wrap lines at the wrong column? Readline, the line editing library that bash uses, does not know @@ -757,10 +805,10 @@ characters in the prompt strings take up no screen space. Use the \[ escape to begin a sequence of non-printing characters, and the \] escape to signal the end of such a sequence. -26) How can I find the value of a shell variable whose name is the value +27) How can I find the value of a shell variable whose name is the value of another shell variable? -Bash-2.0 supports this directly. You can use +Bash-2.01 supports this directly. You can use ${!var} @@ -782,13 +830,13 @@ parameter: The expansion of the quoted portions of this expression will be deferred until `eval' runs, while the `$#' will be expanded -before `eval' is executed. In bash-2.0, +before `eval' is executed. In bash-2.01, echo ${!#} does the same thing. -27) If I pipe the output of a command into `read variable', why doesn't +28) 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 @@ -844,7 +892,7 @@ this. This is the general approach -- in most cases you will not need to set $IFS to a different value. -28) I have a bunch of shell scripts that use backslash-escaped characters +29) 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? @@ -864,7 +912,7 @@ configure with the --enable-usg-echo-default option to turn this on. Be aware that this will cause some of the tests run when you type `make tests' to fail. -29) Why doesn't a while or for loop get suspended when I type ^Z? +30) Why doesn't a while or for loop get suspended when I type ^Z? This is a consequence of how job control works on Unix. The only thing that can be suspended is the process group. This is a single @@ -879,7 +927,7 @@ 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. -30) How can I make the bash `time' reserved word print timing output that +31) How can I make the bash `time' reserved word print timing output that looks like the output from my system's /usr/bin/time? The bash command timing code looks for a variable `TIMEFORMAT' and @@ -913,7 +961,7 @@ The ksh format can be emulated with: Section F: Things to watch out for on certain Unix versions -31) Why can't I use command line editing in my `cmdtool'? +32) Why can't I use command line editing in my `cmdtool'? The problem is `cmdtool' and bash fighting over the input. When scrolling is enabled in a cmdtool window, cmdtool puts the tty in @@ -941,7 +989,7 @@ The bash command-line editing should behave better in the new cmdtool. If this works, you can put the assignment to TERMCAP in your bashrc file. -32) I built bash on Solaris 2. Why do globbing expansions and filename +33) I built bash on Solaris 2. Why do globbing expansions and filename completion chop off the first few characters of each filename? This is the consequence of building bash on SunOS 5 and linking @@ -961,7 +1009,7 @@ If you have installed the Sun C compiler, you may also need to put /usr/ccs/bin and /opt/SUNWspro/bin into your $PATH before /usr/ucb. -33) Why does bash dump core after I interrupt username completion or +34) Why does bash dump core after I interrupt username completion or `~user' tilde expansion on a machine running NIS? This is a famous and long-standing bug in the SunOS YP (sorry, NIS) @@ -984,7 +1032,7 @@ times; that's probably why this has never been fixed. You can run configure with the `--without-gnu-malloc' option to use the C library malloc and avoid the problem. -34) I'm running SVR4.2. Why is the line erased every time I type `@'? +35) I'm running SVR4.2. Why is the line erased every time I type `@'? The `@' character is the default `line kill' character in most versions of System V, including SVR4.2. You can change this @@ -995,7 +1043,7 @@ change the line kill character to control-u, type where the `^' and `U' can be two separate characters. -35) Why does bash report syntax errors when my C News scripts use a +36) Why does bash report syntax errors when my C News scripts use a redirection before a subshell command? The actual command in question is something like @@ -1007,7 +1055,7 @@ is, in fact, a syntax error. Redirections may only precede `simple commands'. A subshell construct such as the above is one of the shell's `compound commands'. A redirection may only follow a compound command. -The file CWRU/sh-redir-hack in the bash-2.0 distribution is an +The file CWRU/sh-redir-hack in the bash-2.01 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 @@ -1016,7 +1064,7 @@ number of reduce/reduce conflicts into the shell grammar. Section G: Where do I go from here? -36) How do I report bugs in bash, and where should I look for fixes and +37) How do I report bugs in bash, and where should I look for fixes and advice? Use the `bashbug' script to report bugs. It is built and @@ -1034,7 +1082,7 @@ and problems also take place there. To reach the bash maintainers directly, send mail to bash-maintainers@prep.ai.mit.edu. -37) What kind of bash documentation is there? +38) What kind of bash documentation is there? First, look in the doc directory in the bash distribution. It should contain at least the following files: @@ -1056,19 +1104,23 @@ slc2.ins.cwru.edu in the `pub/bash' directory. Cameron Newham and Bill Rosenblatt have written a book on bash, published by O'Reilly and Associates. The book is based on Bill Rosenblatt's Korn -Shell book. The title is ``Learning the Bash Shell''. The ISBN number is -1-56592-147-X. Look for it in fine bookstores near you. This book covers -bash-1.14, but has an appendix describing some of the new features in -bash-2.0. +Shell book. The title is ``Learning the Bash Shell'', and the ISBN number +is 1-56592-147-X. Look for it in fine bookstores near you. This book +covers bash-1.14, but has an appendix describing some of the new features +in bash-2.0. There are rumors of a second edition of this book, describing +bash-2.0 (and 2.01). I do not know what ORA's publication schedule for +this edition is. -38) What's coming in future versions? +39) What's coming in future versions? These are features I plan to include in a future version of bash. POSIX.2-style globbing character classes ([:alpha:], [:alnum:], etc.) -a bash debugger (an incomplete, untested version is included with bash-2.0) +POSIX.2-style globbing equivalence classes +POSIX.2-style globbing collating symbols +a bash debugger (a minimally-tested version is included with bash-2.01) -39) What's on the bash `wish list' for future versions? +40) What's on the bash `wish list' for future versions? These are features that may or may not appear in a future version of bash. @@ -1084,7 +1136,7 @@ timeouts for the `read' builtin the ksh-93 ${!prefix*} and ${!prefix@} operators arithmetic ++ and -- prefix and postfix operators -40) When will the next release appear? +41) When will the next release appear? The next version will appear sometime in 1997. Never make predictions. diff --git a/doc/Makefile.in b/doc/Makefile.in index 3ac3012..3f4ee98 100644 --- a/doc/Makefile.in +++ b/doc/Makefile.in @@ -148,14 +148,20 @@ installdirs: install: info installdirs -$(INSTALL_DATA) $(srcdir)/bash.1 $(man1dir)/bash.${man1ext} -$(INSTALL_DATA) $(srcdir)/bashbug.1 $(man1dir)/bashbug.${man1ext} - -$(INSTALL_DATA) $(srcdir)/readline.3 $(man3dir)/readline.${man3ext} - -$(INSTALL_DATA) $(srcdir)/bashref.info $(infodir)/bash.info +# uncomment the next line to install the readline man page +# -$(INSTALL_DATA) $(srcdir)/readline.3 $(man3dir)/readline.${man3ext} # uncomment the next line to install the builtins man page # $(INSTALL_DATA) builtins.1 $(man1dir)/bash_builtins.${man1ext} + -$(INSTALL_DATA) $(srcdir)/bashref.info $(infodir)/bash.info +# run install-info if it is present to update the info directory + if $(SHELL) -c 'install-info --version' >/dev/null 2>&1; then \ + install-info --dir-file=$(infodir)/dir $(infodir)/bash.info; \ + else true; fi uninstall: - $(RM) $(man1dir)/bash.${man1ext} $(man1dir)/bashbug.${man1ext} - $(RM) $(man3dir)/readline.${man3ext} $(infodir)/bash.info + -$(RM) $(man1dir)/bash.${man1ext} $(man1dir)/bashbug.${man1ext} + -$(RM) $(man3dir)/readline.${man3ext} + $(RM) $(infodir)/bash.info # for use by chet inst: bashref.texi @@ -6,11 +6,11 @@ .\" Case Western Reserve University .\" chet@ins.CWRU.Edu .\" -.\" Last Change: Mon Nov 25 15:36:20 EST 1996 +.\" Last Change: Mon May 19 12:45:24 EDT 1997 .\" .\" bash_builtins, strip all but Built-Ins section .if \n(zZ=1 .ig zZ -.TH BASH 1 "1996 Nov 25" GNU +.TH BASH 1 "1997 May 19" GNU .\" .\" There's some problem with having a `@' .\" in a tagged paragraph with the BSD man macros. @@ -256,8 +256,9 @@ section. .PP When .B bash -is invoked as a login shell, it first reads and executes commands -from the file \fI/etc/profile\fP, if that file exists. +is invoked as an interactive login shell, it first reads and +executes commands from the file \fI/etc/profile\fP, if that +file exists. After reading that file, it looks for \fI~/.bash_profile\fP, \fI~/.bash_login\fP, and \fI~/.profile\fP, in that order, and reads and executes commands from the first one that exists and is readable. @@ -623,7 +624,7 @@ is the exit status of the last command executed in .IR list , or zero if no commands were executed. .TP -\fBcase\fP \fIword\fP \fBin\fP [ \fIpattern\fP [ \fB|\fP \fIpattern\fP ] \ +\fBcase\fP \fIword\fP \fBin\fP [ ( \fIpattern\fP [ \fB|\fP \fIpattern\fP ] \ ... ) \fIlist\fP ;; ] ... \fBesac\fP A \fBcase\fP command first expands \fIword\fP, and tries to match it against each \fIpattern\fP in turn, using the same matching rules @@ -902,7 +903,11 @@ is the first character of the value of the variable. If .SM .B IFS -is null or unset, the parameters are separated by spaces. +is unset, the parameters are separated by spaces. +If +.SM +.B IFS +is null, the parameters are joined without intervening separators. .TP .B @ Expands to the positional parameters, starting from one. When the @@ -999,6 +1004,10 @@ Expands to the user ID of the current user, initialized at shell startup. Expands to the effective user ID of the current user, initialized at shell startup. .TP +.B GROUPS +An array variable containing the list of groups of which the current +user is a member. +.TP .B BASH Expands to the full file name used to invoke this instance of .BR bash . @@ -1221,14 +1230,14 @@ specified by the command. A sample value is ``.:~:/usr''. .TP -.B ENV +.B BASH_ENV If this parameter is set when \fBbash\fP is executing a shell script, its value is interpreted as a filename containing commands to initialize the shell, as in .IR .bashrc . The value of .SM -.B ENV +.B BASH_ENV is subjected to parameter expansion, command substitution, and arithmetic expansion before being interpreted as a file name. .SM @@ -3130,7 +3139,7 @@ below). .SH READLINE This is the library that handles reading input when using an interactive shell, unless the -.B \-noediting +.B \-\-noediting option is given at shell invocation. By default, the line editing commands are similar to those of emacs. A vi-style line editing interface is also available. @@ -3668,11 +3677,22 @@ word expansions. See below for a description of history expansion. .TP .B history\-expand\-line (M\-^) -Perform history expansion on the current line. See +Perform history expansion on the current line. +See .SM .B HISTORY EXPANSION below for a description of history expansion. .TP +.B alias\-expand\-line +Perform alias expansion on the current line. +See +.SM +.B ALIASES +above for a description of alias expansion. +.TP +.B history\-and\-alias\-expand\-line +Perform history and alias expansion on the current line. +.TP .B insert\-last\-argument (M\-.\^, M\-_\^) A synonym for \fByank\-last\-arg\fP. .TP @@ -3794,9 +3814,18 @@ Add this digit to the argument already accumulating, or start a new argument. M\-\- starts a negative argument. .TP .B universal\-argument -Each time this is executed, the argument count is multiplied by four. +This is another way to specify an argument. +If this command is followed by one or more digits, optionally with a +leading minus sign, those digits define the argument. +If the command is followed by digits, executing +.B universal\-argument +again ends the numeric argument, but is otherwise ignored. +As a special case, if this command is immediately followed by a +character that is neither a digit or minus sign, the argument count +for the next command is multiplied by four. The argument count is initially one, so executing this function the -first time makes the argument count four. +first time makes the argument count four, a second time makes the +argument count sixteen, and so on. .PD .SS Completing .PP @@ -3980,7 +4009,7 @@ Display version information about the current instance of .PD .SH HISTORY When the -.B -o history +.B \-o history option to the .B set builtin is enabled, the shell provides access to the @@ -5494,12 +5523,15 @@ Arguments, if supplied, have the following meanings: \fB+\fP\fIn\fP Rotates the stack so that the \fIn\fPth directory (counting from the left of the list shown by -.BR dirs ) +.BR dirs , +starting with zero) is at the top. .TP \fB\-\fP\fIn\fP Rotates the stack so that the \fIn\fPth directory -(counting from the right) is at the top. +(counting from the right of the list shown by +.BR dirs , +starting with zero) is at the top. .TP .B \-n Suppresses the normal change of directory when adding directories @@ -6006,7 +6038,7 @@ The errors checked for are transposed characters, a missing character, and one character too many. If a correction is found, the corrected file name is printed, and the command proceeds. -This option is enabled by default, but is only used by interactive shells. +This option is only used by interactive shells. .TP 8 .B checkhash If set, \fBbash\fP checks that a command found in the hash @@ -6303,7 +6335,7 @@ may be positive or negative integers. Print the accumulated user and system times for the shell and for processes run from the shell. The return status is 0. .TP -\fBtrap\fP [\fB\-lp\fP] [\fIarg\fP] [\fIsigspec\fP] +\fBtrap\fP [\fB\-lp\fP] [\fIarg\fP] [\fIsigspec\fP ...] The command .I arg is to be read and executed when the shell receives @@ -6315,11 +6347,12 @@ is absent or .BR \- , all specified signals are reset to their original values (the values they had -upon entrance to the shell). If +upon entrance to the shell). +If .I arg -is the null string this -signal is ignored by the shell and by the -commands it invokes. +is the null string the signal specified by each +.I sigspec +is ignored by the shell and by the commands it invokes. If .I arg is @@ -6333,16 +6366,18 @@ only is given, .B trap prints the list of commands associated with each signal number. +Each .I sigspec is either -a signal name defined in <\fIsignal.h\fP>, or a signal number. If +a signal name defined in <\fIsignal.h\fP>, or a signal number. +If a .I sigspec is .SM .B EXIT (0) the command .I arg -is executed on exit from the shell. If +is executed on exit from the shell. If a .I sigspec is .SM @@ -6359,7 +6394,8 @@ option causes the shell to print a list of signal names and their corresponding numbers. Signals ignored upon entry to the shell cannot be trapped or reset. Trapped signals are reset to their original values in a child -process when it is created. The return status is false if any +process when it is created. +The return status is false if any .I sigspec is invalid; otherwise .B trap @@ -6723,8 +6759,7 @@ that you have. Once you have determined that a bug actually exists, use the .I bashbug command to submit a bug report. -If you have a fix, you are welcome to mail that -as well! +If you have a fix, you are encouraged to mail that as well! Suggestions and `philosophical' bug reports may be mailed to \fPbug-bash\fP@\fIprep.ai.MIT.Edu\fP or posted to the Usenet newsgroup diff --git a/doc/bashref.info b/doc/bashref.info index 6e4ecc1..974c2ce 100644 --- a/doc/bashref.info +++ b/doc/bashref.info @@ -4,9 +4,9 @@ input file ./bashref.texi. This text is a brief description of the features that are present in the Bash shell. -This is Edition 2.0, last updated 25 November 1996, +This is Edition 2.0, last updated 19 May 1997, of `The GNU Bash Reference Manual', -for `Bash', Version 2.0. +for `Bash', Version 2.01. Copyright (C) 1991, 1993, 1996 Free Software Foundation, Inc. @@ -33,8 +33,8 @@ Bash Features This text is a brief description of the features that are present in the Bash shell. - This is Edition 2.0, last updated 25 November 1996, of `The GNU Bash -Reference Manual', for `Bash', Version 2.0. + This is Edition 2.0, last updated 19 May 1997, of `The GNU Bash +Reference Manual', for `Bash', Version 2.01. Copyright (C) 1991, 1993, 1996 Free Software Foundation, Inc. @@ -205,8 +205,8 @@ Definitions descended from it, that are all in the same process group. `job control' - A mechanism by which users can selectively start and stop execution - of processes. + A mechanism by which users can selectively stop (suspend) and + restart (resume) execution of processes. `metacharacter' A character that, when unquoted, separates words. A metacharacter @@ -612,7 +612,7 @@ Conditional Constructs `case' The syntax of the `case' command is: - `case WORD in [PATTERN [| PATTERN]...) COMMANDS ;;]... esac' + `case WORD in [ ( PATTERN [| PATTERN]...) COMMANDS ;;]... esac' Selectively execute COMMANDS based upon WORD matching PATTERN. The `|' is used to separate multiple patterns. @@ -634,7 +634,7 @@ Conditional Constructs (( EXPRESSION )) The EXPRESSION is evaluated according to the rules described below - ((*note Arithmetic Evaluation::.). If the value of the expression + (*note Arithmetic Evaluation::.). If the value of the expression is non-zero, the return status is 0; otherwise the return status is 1. This is exactly equivalent to let "EXPRESSION" @@ -673,8 +673,8 @@ the list may be redirected to a single stream. difference between these two constructs due to historical reasons. The braces are `reserved words', so they must be separated from the LIST by `blank's. The parentheses are `operators', and are recognized as -separate tokens by the shell even if they are not separated from `list' -by whitespace. +separate tokens by the shell even if they are not separated from the +LIST by whitespace. The exit status of both of these constructs is the exit status of LIST. @@ -701,7 +701,7 @@ status of the last command executed in the body. When a function is executed, the arguments to the function become the positional parameters during its execution (*note Positional -Parameters::.). The special parameter `#' that gives the number of +Parameters::.). The special parameter `#' that expands to the number of positional parameters is updated to reflect the change. Positional parameter `0' is unchanged. @@ -783,8 +783,9 @@ only be referenced; assignment to them is not allowed. with the value of each parameter separated by the first character of the `IFS' special variable. That is, `"$*"' is equivalent to `"$1C$2C..."', where C is the first character of the value of the - `IFS' variable. If `IFS' is null or unset, the parameters are - separated by spaces. + `IFS' variable. If `IFS' is unset, the parameters are separated + by spaces. If `IFS' is null, the parameters are joined without + intervening separators. `@' Expands to the positional parameters, starting from one. When the @@ -880,7 +881,7 @@ parameter, variable, and arithemtic expansion and command substitution. Only brace expansion, word splitting, and filename expansion can change the number of words of the expansion; other expansions expand a single word to a single word. The only exceptions to this are the -expansions of `"$@"' (*note Special Parameters::.) and `"${[@]}"' +expansions of `"$@"' (*note Special Parameters::.) and `"${NAME[@]}"' (*note Arrays::.). After all expansions, `quote removal' (*note Quote Removal::.) is @@ -907,9 +908,9 @@ name. If the first character of PARAMETER is an exclamation point, a level of variable indirection is introduced. Bash uses the value of the variable formed from the rest of PARAMETER as the name of the variable; -this variable is then expanded and that value used in the rest of the -substitution, rather than the value of PARAMETER itself. This is known -as `indirect expansion'. +this variable is then expanded and that value is used in the rest of +the substitution, rather than the value of PARAMETER itself. This is +known as `indirect expansion'. In each of the cases below, WORD is subject to tilde expansion, parameter expansion, command substitution, and arithmetic expansion. @@ -1654,20 +1655,21 @@ standard. children. `trap' - trap [-lp] [ARG] [SIGSPEC] + trap [-lp] [ARG] [SIGSPEC ...] The commands in ARG are to be read and executed when the shell receives signal SIGSPEC. If ARG is absent or equal to `-', all specified signals are reset to the values they had when the shell - was started. If ARG is the null string, then SIGSPEC is ignored by - the shell and commands it invokes. If ARG is `-p', the shell - displays the trap commands associated with each SIGSPEC. If no - arguments are supplied, or only `-p' is given, `trap' prints the - list of commands associated with each signal number. SIGSPEC is - either a signal name such as `SIGINT' or a signal number. If - SIGSPEC is `0' or `EXIT', ARG is executed when the shell exits. - If SIGSPEC is `DEBUG', the command ARG is executed after every - simple command. The `-l' option causes the shell to print a list - of signal names and their corresponding numbers. + was started. If ARG is the null string, then the signal specified + by each SIGSPEC is ignored by the shell and commands it invokes. + If ARG is `-p', the shell displays the trap commands associated + with each SIGSPEC. If no arguments are supplied, or only `-p' is + given, `trap' prints the list of commands associated with each + signal number. Each SIGSPEC is either a signal name such as + `SIGINT' (with or without the `SIG' prefix) or a signal number. + If a SIGSPEC is `0' or `EXIT', ARG is executed when the shell + exits. If a SIGSPEC is `DEBUG', the command ARG is executed after + every simple command. The `-l' option causes the shell to print a + list of signal names and their corresponding numbers. Signals ignored upon entry to the shell cannot be trapped or reset. Trapped signals are reset to their original values in a child @@ -1826,7 +1828,7 @@ translation of the characters between the double quotes. The `-D' and `--dump-strings' invocation options list the translatable strings found in a script (*note Locale Translation::.). - The expansion `${var:'LENGTH`[:'OFFSET`]}', which expands to the + The expansion `${var:'OFFSET`[:'LENGTH`]}', which expands to the substring of `var''s value of length LENGTH, optionally beginning at OFFSET, is present (*note Shell Parameter Expansion::.). @@ -1842,10 +1844,10 @@ Parameter Expansion::.). Bash has process substitution (*note Process Substitution::.). Bash automatically assigns variables that provide information about -the current user (`UID' and `EUID'), the current host (`HOSTTYPE', -`OSTYPE', `MACHTYPE', and `HOSTNAME'), and the instance of Bash that is -running (`BASH', `BASH_VERSION', and `BASH_VERSINFO'. *Note Bash -Variables::, for details. +the current user (`UID', `EUID', and `GROUPS'), the current host +(`HOSTTYPE', `OSTYPE', `MACHTYPE', and `HOSTNAME'), and the instance of +Bash that is running (`BASH', `BASH_VERSION', and `BASH_VERSINFO'. +*Note Bash Variables::, for details. The `IFS' variable is used to split only the results of expansion, not all words (*note Word Splitting::.). This closes a longstanding @@ -1858,9 +1860,9 @@ shell security hole. `local' builtin, and thus useful recursive functions may be written. Variable assignments preceding commands affect only that command, -even builtins and functions. In `sh', all variable assignments -preceding commands are global unless the command is executed from the -file system. +even builtins and functions (*note Environment::.). In `sh', all +variable assignments preceding commands are global unless the command +is executed from the file system. Bash performs filename expansion on filenames specified as operands to output redirection operators. @@ -1932,16 +1934,17 @@ shell input, a `-n' option to remove various variable attributes, and `name=value' arguments to set variable attributes and values simultaneously. - The Bash `cd' and `pwd' builtins each take `-L' and `-P' builtins to -switch between logical and physical modes. + The Bash `cd' and `pwd' builtins (*note Bourne Shell Builtins::.) +each take `-L' and `-P' builtins to switch between logical and physical +modes. The Bash `type' builtin is more extensive and gives more information -about the names it finds. +about the names it finds (*note Bash Builtins::.). Bash implements a `csh'-like directory stack, and provides the -`pushd', `popd', and `dirs' builtins to manipulate it. Bash also makes -the directory stack visible as the value of the `DIRSTACK' shell -variable. +`pushd', `popd', and `dirs' builtins to manipulate it (*note C Shell +Builtins::.). Bash also makes the directory stack visible as the value +of the `DIRSTACK' shell variable. The Bash restricted mode is more useful (*note The Restricted Shell::.); the SVR4.2 shell restricted mode is too limited. @@ -1979,10 +1982,10 @@ from many of the limitations of the SVR4.2 shell. For instance: `SIGSEGV' blocked (e.g., by using the `system()' C library function call), the shell misbehaves badly. - * In a questionable attempt at security, the SVR4.2 shell will alter - its real and effective UID and GID if they are less than some - threshold value, commonly 100. This can lead to unexpected - results. + * In a questionable attempt at security, the SVR4.2 shell, when + invoked without the `-p' option, will alter its real and effective + UID and GID if they are less than some magic threshold value, + commonly 100. This can lead to unexpected results. * The SVR4.2 shell does not allow users to trap `SIGALRM' or `SIGCHLD'. @@ -1999,7 +2002,7 @@ from many of the limitations of the SVR4.2 shell. For instance: * The SVR4.2 shell exits a script if any builtin fails; Bash exits a script only if one of the POSIX.2 special builtins fails, and only - for certain failures, as enumerated in the `POSIX.2' standard. + for certain failures, as enumerated in the POSIX.2 standard. * The SVR4.2 shell behaves differently when invoked as `jsh' (it turns on job control). @@ -2108,13 +2111,13 @@ to `csh'. `+N' Brings the Nth directory (counting from the left of the list - printed by `dirs') to the top of the list by rotating the - stack. + printed by `dirs', starting with zero) to the top of the list + by rotating the stack. `-N' Brings the Nth directory (counting from the right of the list - printed by `dirs') to the top of the list by rotating the - stack. + printed by `dirs', starting with zero) to the top of the list + by rotating the stack. `-n' Suppresses the normal change of directory when adding @@ -2288,10 +2291,10 @@ saved in the variable `REPLY'. completes. Bash also has adopted command timing from the Korn shell. If the -`time' reserved word precedes a pipeline or simple command, timing -statistics for the pipeline are displayed when it completes. The -statistics currently consist of elapsed (wall-clock) time and user and -system time consumed by the command's execution. +`time' reserved word precedes a pipeline, which may consist of a single +command, timing statistics for the pipeline are displayed when it +completes. The statistics currently consist of elapsed (wall-clock) +time and user and system time consumed by the command's execution. The use of `time' as a reserved word permits the timing of shell builtins, shell functions, and pipelines. An external `time' command @@ -2389,12 +2392,6 @@ Korn Shell Variables The line number in the script or shell function currently executing. -`ENV' - If this variable is set when Bash is invoked to execute a shell - script, its value is expanded and used as the name of a startup - file to read before executing the script. *Note Bash Startup - Files::. - `FCEDIT' The editor used as a default by the `fc' builtin command. @@ -2609,17 +2606,18 @@ File: bashref.info, Node: Bash Startup Files, Next: Is This Shell Interactive? Bash Startup Files ================== - This section describs how bash executes its startup files. If any -of the files exist but cannot be read, bash reports an error. Tildes + This section describs how Bash executes its startup files. If any +of the files exist but cannot be read, Bash reports an error. Tildes are expanded in file names as described above under Tilde Expansion (*note Tilde Expansion::.). - When Bash is invoked as a login shell, it first reads and executes -commands from the file `/etc/profile', if that file exists. After -reading that file, it looks for `~/.bash_profile', `~/.bash_login', and -`~/.profile', in that order, and reads and executes commands from the -first one that exists and is readable. The `--noprofile' option may be -used when the shell is started to inhibit this behavior. + When Bash is invoked as an interactive login shell, it first reads +and executes commands from the file `/etc/profile', if that file exists. +After reading that file, it looks for `~/.bash_profile', +`~/.bash_login', and `~/.profile', in that order, and reads and +executes commands from the first one that exists and is readable. The +`--noprofile' option may be used when the shell is started to inhibit +this behavior. When a login shell exits, Bash reads and executes commands from the file `~/.bash_logout', if it exists. @@ -2667,7 +2665,7 @@ are read. line option, it follows the POSIX standard for startup files. In this mode, the `ENV' variable is expanded and commands are read and executed from the file whose name is the expanded value. No other startup files -are read. This is done by both interactive and non-interactive shells. +are read. This is done by interactive shells only. Bash attempts to determine when it is being run by the remote shell daemon, usually `rshd'. If Bash determines it is being run by rshd, it @@ -2699,6 +2697,14 @@ Thus: echo This shell is interactive fi + Alternatively, you may test the value of the `-' special parameter. +It contains `i' when the shell is interactive. For example: + + case "$-" in + *i*) echo This shell is interactive ;; + *) echo This shell is not interactive ;; + esac + File: bashref.info, Node: Bash Builtins, Next: The Set Builtin, Prev: Is This Shell Interactive?, Up: Bash Features @@ -2764,9 +2770,9 @@ been extended in Bash. `builtin' builtin [SHELL-BUILTIN [ARGS]] - Run a shell builtin. This is useful when you wish to rename a - shell builtin to be a function, but need the functionality of the - builtin within the function itself. + Run a shell builtin. This is useful when you wish to define a + shell function with the same name as a shell builtin, but need the + functionality of the builtin within the function itself. `command' command [-pVv] COMMAND [ARGS ...] @@ -2974,7 +2980,7 @@ been extended in Bash. are transposed characters, a missing character, and a character too many. If a correction is found, the corrected path is printed, and the command proceeds. This option is - enabled by default, but is only used by interactive shells. + only used by interactive shells. `checkhash' If this is set, Bash checks that a command found in the hash @@ -3018,7 +3024,8 @@ been extended in Bash. `hostcomplete' If set, and Readline is being used, Bash will attempt to perform hostname completion when a word beginning with `@' is - being completed (*note Commands For Completion::.). + being completed (*note Commands For Completion::.). This + option is enabled by default. `interactive_comments' Allow a word beginning with `#' to cause that word and all @@ -3249,10 +3256,10 @@ The Set Builtin same as `-x'. `-p' - Turn on privileged mode. In this mode, the `$ENV' file is - not processed, and shell functions are not inherited from the - environment. This is enabled automatically on startup if the - effective user (group) id is not equal to the real user + Turn on privileged mode. In this mode, the `$BASH_ENV' file + is not processed, and shell functions are not inherited from + the environment. This is enabled automatically on startup if + the effective user (group) id is not equal to the real user (group) id. Turning this option off causes the effective user and group ids to be set to the real user and group ids. @@ -3484,6 +3491,12 @@ Bash Variables These variables are set or used by Bash, but other shells do not normally treat them specially. +`BASH_ENV' + If this variable is set when Bash is invoked to execute a shell + script, its value is expanded and used as the name of a startup + file to read before executing the script. *Note Bash Startup + Files::. + `TIMEFORMAT' The value of this parameter is used as a format string specifying how the timing information for pipelines prefixed with the `time' @@ -3518,9 +3531,9 @@ normally treat them specially. fraction is included. If this variable is not set, bash acts as if it had the value - `$'\nreal\t%3lR\nuser\t%3lU\nsys\t%3lS''. If the value is null, - no timing information is displayed. A trailing newline is added - when the format string is displayed. + `$'\nreal\t%3lR\nuser\t%3lU\nsys\t%3lS''. + If the value is null, no timing information is displayed. A + trailing newline is added when the format string is displayed. `HISTCONTROL' Set to a value of `ignorespace', it means don't enter lines which @@ -3603,6 +3616,10 @@ normally treat them specially. `EUID' The numeric effective user id of the current user. +`GROUPS' + An array variable containing the list of groups of which the + current user is a member. + `PPID' The process id of the shell's parent process. @@ -3691,8 +3708,8 @@ normally treat them specially. `SHLVL' Incremented by one each time a new instance of Bash is started. - This is intended to be an account of how deeply your Bash shells - are nested. + This is intended to be a count of how deeply your Bash shells are + nested. `OPTERR' If set to the value 1, Bash displays error messages generated by @@ -3706,9 +3723,13 @@ normally treat them specially. This variable overrides the value of `LANG' and any other `LC_' variable specifying a locale category. +`LC_COLLATE' + This variable determines the collation order used when sorting the + results of filename expansion (*note Filename Expansion::.). + `LC_MESSAGES' This variable determines the locale used to translate double-quoted - strings preceded by a `$'. + strings preceded by a `$' (*note Locale Translation::.). `IGNOREEOF' Controls the action of the shell on receipt of an `EOF' character @@ -4110,6 +4131,9 @@ specified by POSIX.2 in areas where the Bash default differs. 20. Assignment statements preceding POSIX.2 `special' builtins persist in the shell environment after the builtin completes. + 21. The `export' and `readonly' builtin commands display their output + in the format required by POSIX.2. + There is other POSIX.2 behavior that Bash does not implement. Specifically: @@ -4264,10 +4288,11 @@ Job Control Builtins kill [-s SIGSPEC] [-n SIGNUM] [-SIGSPEC] JOBSPEC kill -l [SIGSPEC] Send a signal specified by SIGSPEC or SIGNUM to the process named - by JOBSPEC. SIGSPEC is either a signal name such as `SIGINT' or a - signal number; SIGNUM is a signal number. If SIGSPEC and SIGNUM - are not present, `SIGTERM' is used. The `-l' option lists the - signal names, or the signal name corresponding to SIGSPEC. + by JOBSPEC. SIGSPEC is either a signal name such as `SIGINT' + (with or without the `SIG' prefix) or a signal number; SIGNUM is a + signal number. If SIGSPEC and SIGNUM are not present, `SIGTERM' + is used. The `-l' option lists the signal names, or the signal + name corresponding to SIGSPEC. `wait' wait [JOBSPEC|PID] @@ -4304,12 +4329,12 @@ Job Control Variables This variable controls how the shell interacts with the user and job control. If this variable exists then single word simple commands without redirects are treated as candidates for resumption - of an existing job. There is no ambiguity allowed; if you have - more than one job beginning with the string that you have typed, - then the most recently accessed job will be selected. The name of - a stopped job, in this context, is the command line used to start - it. If this variable is set to the value `exact', the string - supplied must match the name of a stopped job exactly; if set to + of an existing job. There is no ambiguity allowed; if there is + more than one job beginning with the string typed, then the most + recently accessed job will be selected. The name of a stopped + job, in this context, is the command line used to start it. If + this variable is set to the value `exact', the string supplied + must match the name of a stopped job exactly; if set to `substring', the string supplied needs to match a substring of the name of a stopped job. The `substring' value provides functionality analogous to the `%?' job ID (*note Job Control @@ -5094,31 +5119,31 @@ binding, variable assignment, and conditional syntax. # # Arrow keys in keypad mode # - #"\M-OD" backward-char - #"\M-OC" forward-char - #"\M-OA" previous-history - #"\M-OB" next-history + #"\M-OD": backward-char + #"\M-OC": forward-char + #"\M-OA": previous-history + #"\M-OB": next-history # # Arrow keys in ANSI mode # - "\M-[D" backward-char - "\M-[C" forward-char - "\M-[A" previous-history - "\M-[B" next-history + "\M-[D": backward-char + "\M-[C": forward-char + "\M-[A": previous-history + "\M-[B": next-history # # Arrow keys in 8 bit keypad mode # - #"\M-\C-OD" backward-char - #"\M-\C-OC" forward-char - #"\M-\C-OA" previous-history - #"\M-\C-OB" next-history + #"\M-\C-OD": backward-char + #"\M-\C-OC": forward-char + #"\M-\C-OA": previous-history + #"\M-\C-OB": next-history # # Arrow keys in 8 bit ANSI mode # - #"\M-\C-[D" backward-char - #"\M-\C-[C" forward-char - #"\M-\C-[A" previous-history - #"\M-\C-[B" next-history + #"\M-\C-[D": backward-char + #"\M-\C-[C": forward-char + #"\M-\C-[A": previous-history + #"\M-\C-[B": next-history C-q: quoted-insert @@ -5410,10 +5435,17 @@ Specifying Numeric Arguments argument. M- starts a negative argument. `universal-argument ()' - Each time this is executed, the argument count is multiplied by - four. The argument count is initially one, so executing this - function the first time makes the argument count four. By - default, this is not bound to a key. + This is another way to specify an argument. If this command is + followed by one or more digits, optionally with a leading minus + sign, those digits define the argument. If the command is + followed by digits, executing `universal-argument' again ends the + numeric argument, but is otherwise ignored. As a special case, if + this command is immediately followed by a character that is + neither a digit or minus sign, the argument count for the next + command is multiplied by four. The argument count is initially + one, so executing this function the first time makes the argument + count four, a second time makes the argument count sixteen, and so + on. By default, this is not bound to a key. File: bashref.info, Node: Commands For Completion, Next: Keyboard Macros, Prev: Numeric Arguments, Up: Bindable Readline Commands @@ -5606,6 +5638,12 @@ Some Miscellaneous Commands `history-expand-line (M-^)' Perform history expansion on the current line. +`alias-expand-line' + Perform alias expansion on the current line (*note Aliases::.). + +`history-and-alias-expand-line' + Perform history and alias expansion on the current line. + `insert-last-argument (M-., M-_)' A synonym for `yank-last-arg'. @@ -5652,7 +5690,7 @@ OS/2, Windows 95, and Windows NT. * Menu: -* Basic Installation:: Generic installation instructions. +* Basic Installation:: Installation instructions. * Compilers and Options:: How to set special options for various systems. @@ -5679,7 +5717,7 @@ File: bashref.info, Node: Basic Installation, Next: Compilers and Options, Up Basic Installation ================== - These are generic installation instructions for Bash. + These are installation instructions for Bash. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses @@ -5702,7 +5740,15 @@ they can be considered for the next release. The file `configure.in' is used to create `configure' by a program called Autoconf. You only need `configure.in' if you want to change it or regenerate `configure' using a newer version of Autoconf. If you do -this, make sure you are using Autoconf version 2.9 or newer. +this, make sure you are using Autoconf version 2.10 or newer. + + If you need to change `configure.in' or regenerate `configure', you +will need to create two files: `_distribution' and `_patchlevel'. +`_distribution' should contain the major and minor version numbers of +the Bash distribution, for example `2.01'. `_patchlevel' should +contain the patch level of the Bash distribution, `0' for example. The +script `support/mkconffiles' has been provided to automate the creation +of these files. The simplest way to compile Bash is: @@ -5880,21 +5926,27 @@ configure Bash without a feature that is enabled by default, use Here is a complete list of the `--enable-' and `--with-' options that the Bash `configure' recognizes. -`--with-gnu-malloc' - Use the GNU version of `malloc' in `lib/malloc/malloc.c'. This is - not the same `malloc' that appears in GNU libc, but an older - version derived from the 4.2 BSD `malloc'. This `malloc' is very - fast, but wastes a lot of space. This option is enabled by - default. The `NOTES' file contains a list of systems for which - this should be turned off. +`--with-afs' + Define if you are using the Andrew File System from Transarc. + +`--with-curses' + Use the curses library instead of the termcap library. This should + be supplied if your system has an inadequate or incomplete termcap + database. `--with-glibc-malloc' Use the GNU libc version of `malloc' in `lib/malloc/gmalloc.c'. This is somewhat slower than the default `malloc', but wastes considerably less space. -`--with-afs' - Define if you are using the Andrew File System from Transarc. +`--with-gnu-malloc' + Use the GNU version of `malloc' in `lib/malloc/malloc.c'. This is + not the same `malloc' that appears in GNU libc, but an older + version derived from the 4.2 BSD `malloc'. This `malloc' is very + fast, but wastes a lot of space. This option is enabled by + default. The `NOTES' file contains a list of systems for which + this should be turned off, and `configure' disables this option + automatically for a number of systems. `--with-purify' Define this to use the Purify memory allocation checker from Pure @@ -5912,32 +5964,48 @@ enabled using `enable-FEATURE'. `usg-echo-default' are enabled by default, unless the operating system does not provide the necessary support. -`--enable-job-control' - This enables job control features, if the OS supports them. - `--enable-alias' Allow alias expansion and include the `alias' and `unalias' builtins. -`--enable-readline' - Include support for command-line editing and history with the Bash - version of the Readline library. - -`--enable-history' - Include command history and the `fc' and `history' builtin - commands. +`--enable-array-variables' + Include support for one-dimensional array shell variables. `--enable-bang-history' Include support for `csh'-like history substitution. +`--enable-brace-expansion' + Include `csh'-like brace expansion ( `b{a,b}c' ==> `bac bbc' ). + +`--enable-command-timing' + Include support for recognizing `time' as a reserved word and for + displaying timing statistics for the pipeline following `time'. + This allows pipelines as well as shell builtins and functions to + be timed. + `--enable-directory-stack' Include support for a `csh'-like directory stack and the `pushd', `popd', and `dirs' builtins. -`--enable-restricted' - Include support for a "restricted shell". If this is enabled, - Bash, when called as `rbash', enters a restricted mode. See *Note - The Restricted Shell::, for a description of restricted mode. +`--enable-disabled-builtins' + Allow builtin commands to be invoked via `builtin xxx' even after + `xxx' has been disabled using `enable -n xxx'. See *Note Bash + Builtins::, for details of the `builtin' and `enable' builtin + commands. + +`--enable-dparen-arithmetic' + Include support for the `ksh' `((...))' command. + +`--enable-help-builtin' + Include the `help' builtin, which displays help on shell builtins + and variables. + +`--enable-history' + Include command history and the `fc' and `history' builtin + commands. + +`--enable-job-control' + This enables job control features, if the OS supports them. `--enable-process-substitution' This enables process substitution (*note Process Substitution::.) @@ -5948,35 +6016,19 @@ does not provide the necessary support. characters in the `$PS1', `$PS2', `$PS3', and `$PS4' prompt strings. +`--enable-readline' + Include support for command-line editing and history with the Bash + version of the Readline library. + +`--enable-restricted' + Include support for a "restricted shell". If this is enabled, + Bash, when called as `rbash', enters a restricted mode. See *Note + The Restricted Shell::, for a description of restricted mode. + `--enable-select' Include the `ksh' `select' builtin, which allows the generation of simple menus. -`--enable-help-builtin' - Include the `help' builtin, which displays help on shell builtins - and variables. - -`--enable-array-variables' - Include support for one-dimensional array shell variables. - -`--enable-dparen-arithmetic' - Include support for the `ksh' `((...))' command. - -`--enable-brace-expansion' - Include `csh'-like brace expansion ( `b{a,b}c' ==> `bac bbc' ). - -`--enable-disabled-builtins' - Allow builtin commands to be invoked via `builtin xxx' even after - `xxx' has been disabled using `enable -n xxx'. See *Note Bash - Builtins::, for details of the `builtin' and `enable' builtin - commands. - -`--enable-command-timing' - Include support for recognizing `time' as a reserved word and for - displaying timing statistics for the pipeline following `time'. - This allows pipelines as well as shell builtins and functions to - be timed. - `--enable-usg-echo-default' Make the `echo' builtin expand backslash-escaped characters by default, without requiring the `-e' option. This makes the Bash @@ -6000,7 +6052,7 @@ of Bash that you have. Once you have determined that a bug actually exists, use the `bashbug' command to submit a bug report. If you have a fix, you are -welcome to mail that as well! Suggestions and `philosophical' bug +encouraged to mail that as well! Suggestions and `philosophical' bug reports may be mailed to `bug-bash@prep.ai.MIT.Edu' or posted to the Usenet newsgroup `gnu.bash.bug'. @@ -6132,6 +6184,7 @@ Parameter and Variable Index * _: Special Parameters. * auto_resume: Job Control Variables. * BASH: Bash Variables. +* BASH_ENV: Bash Variables. * BASH_VERSINFO: Bash Variables. * BASH_VERSION: Bash Variables. * bell-style: Readline Init File Syntax. @@ -6143,12 +6196,12 @@ Parameter and Variable Index * disable-completion: Readline Init File Syntax. * editing-mode: Readline Init File Syntax. * enable-keypad: Readline Init File Syntax. -* ENV: Korn Shell Variables. * EUID: Bash Variables. * expand-tilde: Readline Init File Syntax. * FCEDIT: Korn Shell Variables. * FIGNORE: Bash Variables. * GLOBIGNORE: Bash Variables. +* GROUPS: Bash Variables. * histchars: Bash Variables. * HISTCMD: Bash Variables. * HISTCONTROL: Bash Variables. @@ -6169,6 +6222,7 @@ Parameter and Variable Index * keymap: Readline Init File Syntax. * LANG: Bash Variables. * LC_ALL: Bash Variables. +* LC_COLLATE: Bash Variables. * LC_MESSAGES: Bash Variables. * LINENO: Korn Shell Variables. * MACHTYPE: Bash Variables. @@ -6391,123 +6445,123 @@ Concept Index Tag Table: -Node: Top1009 -Node: Introduction3117 -Node: What is Bash?3342 -Node: What is a shell?4426 -Node: Definitions6307 -Node: Basic Shell Features8947 -Node: Shell Syntax10468 -Node: Shell Operation10758 -Node: Quoting11992 -Node: Escape Character13027 -Node: Single Quotes13458 -Node: Double Quotes13787 -Node: ANSI-C Quoting14483 -Node: Locale Translation15215 -Node: Comments15636 -Node: Simple Commands16160 -Node: Pipelines16749 -Node: Lists17820 -Node: Looping Constructs19095 -Node: Conditional Constructs20272 -Node: Command Grouping22337 -Node: Shell Functions23721 -Node: Shell Parameters25489 -Node: Positional Parameters26812 -Node: Special Parameters27506 -Node: Shell Expansions29998 -Node: Shell Parameter Expansion31998 -Node: Command Substitution38003 -Node: Process Substitution39003 -Node: Word Splitting39909 -Node: Filename Expansion41361 -Node: Quote Removal43727 -Node: Redirections44013 -Node: Executing Commands49754 -Node: Command Search and Execution50209 -Node: Environment51943 -Node: Exit Status53579 -Node: Signals54596 -Node: Shell Scripts55807 -Node: Bourne Shell Features57676 -Node: Bourne Shell Builtins58346 -Node: Bourne Shell Variables66619 -Node: Other Bourne Shell Features68156 -Node: Major Differences From The Bourne Shell68913 -Node: Csh Features79111 -Node: Brace Expansion80029 -Node: Tilde Expansion81584 -Node: C Shell Builtins82216 -Node: C Shell Variables86732 -Node: Korn Shell Features87140 -Node: Korn Shell Constructs87868 -Node: Korn Shell Builtins89562 -Node: Korn Shell Variables91720 -Node: Aliases93505 -Node: Alias Builtins95969 -Node: Bash Features96585 -Node: Invoking Bash97576 -Node: Bash Startup Files101441 -Node: Is This Shell Interactive?105024 -Node: Bash Builtins105755 -Node: The Set Builtin121569 -Node: Bash Conditional Expressions126939 -Node: Bash Variables131590 -Node: Shell Arithmetic141103 -Node: Arithmetic Evaluation141571 -Node: Arithmetic Expansion143601 -Node: Arithmetic Builtins144405 -Node: Arrays144876 -Node: Printing a Prompt147903 -Node: The Restricted Shell149501 -Node: Bash POSIX Mode150731 -Node: Job Control154303 -Node: Job Control Basics154768 -Node: Job Control Builtins158911 -Node: Job Control Variables161794 -Node: Using History Interactively162955 -Node: Bash History Facilities163544 -Node: History Interaction165942 -Node: Event Designators168504 -Node: Word Designators169427 -Node: Modifiers170676 -Node: Command Line Editing171993 -Node: Introduction and Notation172653 -Node: Readline Interaction173661 -Node: Readline Bare Essentials174849 -Node: Readline Movement Commands176378 -Node: Readline Killing Commands177268 -Node: Readline Arguments178970 -Node: Searching179943 -Node: Readline Init File181579 -Node: Readline Init File Syntax182635 -Node: Conditional Init Constructs190424 -Node: Sample Init File192705 -Node: Bindable Readline Commands195722 -Node: Commands For Moving196472 -Node: Commands For History197319 -Node: Commands For Text199992 -Node: Commands For Killing201734 -Node: Numeric Arguments203760 -Node: Commands For Completion204386 -Node: Keyboard Macros207348 -Node: Miscellaneous Commands207906 -Node: Readline vi Mode211937 -Node: Installing Bash212813 -Node: Basic Installation213890 -Node: Compilers and Options216389 -Node: Compiling For Multiple Architectures217123 -Node: Installation Names218780 -Node: Specifying the System Type219502 -Node: Sharing Defaults220213 -Node: Operation Controls220878 -Node: Optional Features221783 -Node: Reporting Bugs226408 -Node: Builtin Index227485 -Node: Reserved Word Index230898 -Node: Variable Index232206 -Node: Function Index237285 -Node: Concept Index241643 +Node: Top1005 +Node: Introduction3109 +Node: What is Bash?3334 +Node: What is a shell?4418 +Node: Definitions6299 +Node: Basic Shell Features8960 +Node: Shell Syntax10481 +Node: Shell Operation10771 +Node: Quoting12005 +Node: Escape Character13040 +Node: Single Quotes13471 +Node: Double Quotes13800 +Node: ANSI-C Quoting14496 +Node: Locale Translation15228 +Node: Comments15649 +Node: Simple Commands16173 +Node: Pipelines16762 +Node: Lists17833 +Node: Looping Constructs19108 +Node: Conditional Constructs20285 +Node: Command Grouping22352 +Node: Shell Functions23738 +Node: Shell Parameters25511 +Node: Positional Parameters26834 +Node: Special Parameters27528 +Node: Shell Expansions30094 +Node: Shell Parameter Expansion32098 +Node: Command Substitution38106 +Node: Process Substitution39106 +Node: Word Splitting40012 +Node: Filename Expansion41464 +Node: Quote Removal43830 +Node: Redirections44116 +Node: Executing Commands49857 +Node: Command Search and Execution50312 +Node: Environment52046 +Node: Exit Status53682 +Node: Signals54699 +Node: Shell Scripts55910 +Node: Bourne Shell Features57779 +Node: Bourne Shell Builtins58449 +Node: Bourne Shell Variables66803 +Node: Other Bourne Shell Features68340 +Node: Major Differences From The Bourne Shell69097 +Node: Csh Features79457 +Node: Brace Expansion80375 +Node: Tilde Expansion81930 +Node: C Shell Builtins82562 +Node: C Shell Variables87118 +Node: Korn Shell Features87526 +Node: Korn Shell Constructs88254 +Node: Korn Shell Builtins89969 +Node: Korn Shell Variables92127 +Node: Aliases93686 +Node: Alias Builtins96150 +Node: Bash Features96766 +Node: Invoking Bash97757 +Node: Bash Startup Files101622 +Node: Is This Shell Interactive?105197 +Node: Bash Builtins106180 +Node: The Set Builtin122035 +Node: Bash Conditional Expressions127410 +Node: Bash Variables132061 +Node: Shell Arithmetic142095 +Node: Arithmetic Evaluation142563 +Node: Arithmetic Expansion144593 +Node: Arithmetic Builtins145397 +Node: Arrays145868 +Node: Printing a Prompt148895 +Node: The Restricted Shell150493 +Node: Bash POSIX Mode151723 +Node: Job Control155407 +Node: Job Control Basics155872 +Node: Job Control Builtins160015 +Node: Job Control Variables162938 +Node: Using History Interactively164085 +Node: Bash History Facilities164674 +Node: History Interaction167072 +Node: Event Designators169634 +Node: Word Designators170557 +Node: Modifiers171806 +Node: Command Line Editing173123 +Node: Introduction and Notation173783 +Node: Readline Interaction174791 +Node: Readline Bare Essentials175979 +Node: Readline Movement Commands177508 +Node: Readline Killing Commands178398 +Node: Readline Arguments180100 +Node: Searching181073 +Node: Readline Init File182709 +Node: Readline Init File Syntax183765 +Node: Conditional Init Constructs191554 +Node: Sample Init File193835 +Node: Bindable Readline Commands196868 +Node: Commands For Moving197618 +Node: Commands For History198465 +Node: Commands For Text201138 +Node: Commands For Killing202880 +Node: Numeric Arguments204906 +Node: Commands For Completion206030 +Node: Keyboard Macros208992 +Node: Miscellaneous Commands209550 +Node: Readline vi Mode213766 +Node: Installing Bash214642 +Node: Basic Installation215711 +Node: Compilers and Options218636 +Node: Compiling For Multiple Architectures219370 +Node: Installation Names221027 +Node: Specifying the System Type221749 +Node: Sharing Defaults222460 +Node: Operation Controls223125 +Node: Optional Features224030 +Node: Reporting Bugs228913 +Node: Builtin Index229993 +Node: Reserved Word Index233406 +Node: Variable Index234714 +Node: Function Index239899 +Node: Concept Index244257 End Tag Table diff --git a/doc/bashref.texi b/doc/bashref.texi index fe871c3..6d1719f 100644 --- a/doc/bashref.texi +++ b/doc/bashref.texi @@ -5,13 +5,13 @@ @c %**end of header @ignore -last change: Mon Nov 25 11:47:06 EST 1996 +last change: Mon May 19 12:55:22 EDT 1997 @end ignore @set EDITION 2.0 -@set VERSION 2.0 -@set UPDATED 25 November 1996 -@set UPDATE-MONTH November 1996 +@set VERSION 2.01 +@set UPDATED 19 May 1997 +@set UPDATE-MONTH May 1997 @iftex @finalout @@ -272,8 +272,8 @@ from it, that are all in the same process group. @item job control @cindex job control -A mechanism by which users can selectively start and stop execution -of processes. +A mechanism by which users can selectively stop (suspend) and restart +(resume) execution of processes. @item metacharacter @cindex metacharacter @@ -717,7 +717,7 @@ has a non-zero exit status, then execute @var{alternate-consequents}. The syntax of the @code{case} command is: @example -@code{case @var{word} in [@var{pattern} [| @var{pattern}]@dots{}) @var{commands} ;;]@dots{} esac} +@code{case @var{word} in [ ( @var{pattern} [| @var{pattern}]@dots{}) @var{commands} ;;]@dots{} esac} @end example Selectively execute @var{commands} based upon @var{word} matching @@ -744,7 +744,7 @@ echo " legs." @end example The @var{expression} is evaluated according to the rules described -below ((@pxref{Arithmetic Evaluation}). +below (@pxref{Arithmetic Evaluation}). If the value of the expression is non-zero, the return status is 0; otherwise the return status is 1. This is exactly equivalent to @example @@ -794,7 +794,7 @@ between these two constructs due to historical reasons. The braces are @code{reserved words}, so they must be separated from the @var{list} by @code{blank}s. The parentheses are @code{operators}, and are recognized as separate tokens by the shell even if they are not separated -from @code{list} by whitespace. +from the @var{list} by whitespace. The exit status of both of these constructs is the exit status of @var{list}. @@ -825,10 +825,9 @@ the exit status of the last command executed in the body. When a function is executed, the arguments to the function become the positional parameters during its execution (@pxref{Positional Parameters}). -The special parameter -@samp{#} that gives the number of positional parameters -is updated to reflect the change. Positional parameter @code{0} -is unchanged. +The special parameter @samp{#} that expands to the number of +positional parameters is updated to reflect the change. +Positional parameter @code{0} is unchanged. If the builtin command @code{return} is executed in a function, the function completes and @@ -919,8 +918,11 @@ of the @code{IFS} special variable. That is, @code{"$*"} is equivalent to @code{"$1@var{c}$2@var{c}@dots{}"}, where @var{c} is the first character of the value of the @code{IFS} -variable. If @code{IFS} -is null or unset, the parameters are separated by spaces. +variable. +If @code{IFS} is unset, the parameters are separated by spaces. +If @code{IFS} is null, the parameters are joined without intervening +separators. + @item @@ Expands to the positional parameters, starting from one. When the @@ -1020,7 +1022,7 @@ Only brace expansion, word splitting, and filename expansion can change the number of words of the expansion; other expansions expand a single word to a single word. The only exceptions to this are the expansions of -@code{"$@@"} (@pxref{Special Parameters}) and @code{"$@{[@@]@}"} +@code{"$@@"} (@pxref{Special Parameters}) and @code{"$@{@var{name}[@@]@}"} (@pxref{Arrays}). After all expansions, @code{quote removal} (@pxref{Quote Removal}) @@ -1050,7 +1052,7 @@ If the first character of @var{parameter} is an exclamation point, a level of variable indirection is introduced. Bash uses the value of the variable formed from the rest of @var{parameter} as the name of the variable; this variable is then -expanded and that value used in the rest of the substitution, rather +expanded and that value is used in the rest of the substitution, rather than the value of @var{parameter} itself. This is known as @code{indirect expansion}. @@ -1953,21 +1955,23 @@ Print out the user and system times used by the shell and its children. @item trap @btindex trap @example -trap [-lp] [@var{arg}] [@var{sigspec}] +trap [-lp] [@var{arg}] [@var{sigspec} @dots{}] @end example The commands in @var{arg} are to be read and executed when the shell receives signal @var{sigspec}. If @var{arg} is absent or equal to @samp{-}, all specified signals are reset to the values they had when the shell was started. -If @var{arg} is the null string, then @var{sigspec} is ignored by -the shell and commands it invokes. +If @var{arg} is the null string, then the signal specified by +each @var{sigspec} is ignored by the shell and commands it invokes. If @var{arg} is @samp{-p}, the shell displays the trap commands associated with each @var{sigspec}. If no arguments are supplied, or only @samp{-p} is given, @code{trap} prints the list of commands -associated with each signal number. @var{sigspec} is either a signal -name such as @code{SIGINT} or a signal number. If @var{sigspec} is -@code{0} or @code{EXIT}, @var{arg} is executed when the shell exits. -If @var{sigspec} is @code{DEBUG}, the command @var{arg} is executed +associated with each signal number. +Each @var{sigspec} is either a signal name such as @code{SIGINT} (with +or without the @code{SIG} prefix) or a signal number. +If a @var{sigspec} +is @code{0} or @code{EXIT}, @var{arg} is executed when the shell exits. +If a @var{sigspec} is @code{DEBUG}, the command @var{arg} is executed after every simple command. The @samp{-l} option causes the shell to print a list of signal names and their corresponding numbers. @@ -2136,7 +2140,7 @@ quotes. The @samp{-D} and @samp{--dump-strings} invocation options list the translatable strings found in a script (@pxref{Locale Translation}). -The expansion @code{$@{var:}@var{length}@code{[:}@var{offset}@code{]@}}, +The expansion @code{$@{var:}@var{offset}@code{[:}@var{length}@code{]@}}, which expands to the substring of @code{var}'s value of length @var{length}, optionally beginning at @var{offset}, is present (@pxref{Shell Parameter Expansion}). @@ -2155,7 +2159,7 @@ Bash can expand positional parameters beyond @code{$9} using Bash has process substitution (@pxref{Process Substitution}). Bash automatically assigns variables that provide information about the -current user (@code{UID} and @code{EUID}), the current host +current user (@code{UID}, @code{EUID}, and @code{GROUPS}), the current host (@code{HOSTTYPE}, @code{OSTYPE}, @code{MACHTYPE}, and @code{HOSTNAME}), and the instance of Bash that is running (@code{BASH}, @code{BASH_VERSION}, and @code{BASH_VERSINFO}. @xref{Bash Variables}, @@ -2172,7 +2176,8 @@ Bash functions are permitted to have local variables using the @code{local} builtin, and thus useful recursive functions may be written. Variable assignments preceding commands affect only that command, even -builtins and functions. In @code{sh}, all variable assignments +builtins and functions (@pxref{Environment}). +In @code{sh}, all variable assignments preceding commands are global unless the command is executed from the file system. @@ -2249,14 +2254,16 @@ used as shell input, a @samp{-n} option to remove various variable attributes, and @samp{name=value} arguments to set variable attributes and values simultaneously. -The Bash @code{cd} and @code{pwd} builtins each take @samp{-L} and -@samp{-P} builtins to switch between logical and physical modes. +The Bash @code{cd} and @code{pwd} builtins (@pxref{Bourne Shell Builtins}) +each take @samp{-L} and @samp{-P} builtins to switch between logical and +physical modes. The Bash @code{type} builtin is more extensive and gives more information -about the names it finds. +about the names it finds (@pxref{Bash Builtins}). Bash implements a @code{csh}-like directory stack, and provides the -@code{pushd}, @code{popd}, and @code{dirs} builtins to manipulate it. +@code{pushd}, @code{popd}, and @code{dirs} builtins to manipulate it +(@pxref{C Shell Builtins}). Bash also makes the directory stack visible as the value of the @code{DIRSTACK} shell variable. @@ -2304,10 +2311,11 @@ trapping @code{SIGSEGV}. If the shell is started from a process with function call), the shell misbehaves badly. @item -In a questionable attempt at security, the @sc{SVR4.2} shell -will alter its real +In a questionable attempt at security, the @sc{SVR4.2} shell, +when invoked without the @samp{-p} option, will alter its real and effective @sc{UID} and @sc{GID} if they are less than some -threshold value, commonly 100. This can lead to unexpected results. +magic threshold value, commonly 100. +This can lead to unexpected results. @item The @sc{SVR4.2} shell does not allow users to trap @code{SIGALRM} or @@ -2330,7 +2338,7 @@ with a @samp{-}. @item The @sc{SVR4.2} shell exits a script if any builtin fails; Bash exits a script only if one of the @sc{POSIX.2} special builtins fails, and -only for certain failures, as enumerated in the @code{POSIX.2} standard. +only for certain failures, as enumerated in the @sc{POSIX.2} standard. @item The @sc{SVR4.2} shell behaves differently when invoked as @code{jsh} @@ -2454,12 +2462,12 @@ arguments, exchanges the top two directories. @table @code @item +@var{N} Brings the @var{N}th directory (counting from the left of the -list printed by @code{dirs}) to the top of the list by rotating -the stack. +list printed by @code{dirs}, starting with zero) to the top of +the list by rotating the stack. @item -@var{N} Brings the @var{N}th directory (counting from the right of the -list printed by @code{dirs}) to the top of the list by rotating -the stack. +list printed by @code{dirs}, starting with zero) to the top of +the list by rotating the stack. @item -n Suppresses the normal change of directory when adding directories to the stack, so that only the stack is manipulated. @@ -2644,8 +2652,9 @@ The @var{commands} are executed after each selection until a point the @code{select} command completes. Bash also has adopted command timing from the Korn shell. If the -@code{time} reserved word precedes a pipeline or simple command, -timing statistics for the pipeline are displayed when it completes. +@code{time} reserved word precedes a pipeline, which may consist +of a single command, timing statistics for the pipeline are displayed +when it completes. The statistics currently consist of elapsed (wall-clock) time and user and system time consumed by the command's execution. @@ -2751,11 +2760,6 @@ not arrive. @item LINENO The line number in the script or shell function currently executing. -@item ENV -If this variable is set when Bash is invoked to execute a shell -script, its value is expanded and used as the name of a startup file -to read before executing the script. @xref{Bash Startup Files}. - @item FCEDIT The editor used as a default by the @code{fc} builtin command. @@ -2992,12 +2996,12 @@ in the script. If no commands are executed, the exit status is 0. @section Bash Startup Files @cindex startup files -This section describs how bash executes its startup files. -If any of the files exist but cannot be read, bash reports an error. +This section describs how Bash executes its startup files. +If any of the files exist but cannot be read, Bash reports an error. Tildes are expanded in file names as described above under Tilde Expansion (@pxref{Tilde Expansion}). -When Bash is invoked as a login shell, it first reads and +When Bash is invoked as an interactive login shell, it first reads and executes commands from the file @file{/etc/profile}, if that file exists. After reading that file, it looks for @file{~/.bash_profile}, @file{~/.bash_login}, and @file{~/.profile}, in that order, and reads @@ -3059,7 +3063,7 @@ for startup files. In this mode, the @code{ENV} variable is expanded and commands are read and executed from the file whose name is the expanded value. No other startup files are read. -This is done by both interactive and non-interactive shells. +This is done by interactive shells only. Bash attempts to determine when it is being run by the remote shell daemon, usually @code{rshd}. If Bash determines it is being run by @@ -3093,6 +3097,16 @@ else fi @end example +Alternatively, you may test the value of the @samp{-} special parameter. +It contains @code{i} when the shell is interactive. For example: + +@example +case "$-" in +*i*) echo This shell is interactive ;; +*) echo This shell is not interactive ;; +esac +@end example + @node Bash Builtins @section Bash Builtin Commands @@ -3173,9 +3187,9 @@ Remove any current binding for @var{keyseq} @example builtin [@var{shell-builtin} [@var{args}]] @end example -Run a shell builtin. This is useful when you wish to rename a -shell builtin to be a function, but need the functionality of the -builtin within the function itself. +Run a shell builtin. This is useful when you wish to define a +shell function with the same name as a shell builtin, but need the +functionality of the builtin within the function itself. @item command @btindex command @@ -3423,7 +3437,7 @@ The errors checked for are transposed characters, a missing character, and a character too many. If a correction is found, the corrected path is printed, and the command proceeds. -This option is enabled by default, but is only used by interactive shells. +This option is only used by interactive shells. @item checkhash If this is set, Bash checks that a command found in the hash @@ -3470,7 +3484,8 @@ the Readline editing buffer, allowing further modification. @item hostcomplete If set, and Readline is being used, Bash will attempt to perform hostname completion when a word beginning with @samp{@@} is being -completed (@pxref{Commands For Completion}). +completed (@pxref{Commands For Completion}). This option is enabled +by default. @item interactive_comments Allow a word beginning with @samp{#} @@ -3718,7 +3733,7 @@ same as @code{-x}. @item -p Turn on privileged mode. -In this mode, the @code{$ENV} +In this mode, the @code{$BASH_ENV} file is not processed, and shell functions are not inherited from the environment. This is enabled automatically on startup if the effective user (group) id is not equal to the real @@ -3962,6 +3977,11 @@ do not normally treat them specially. @vtable @code +@item BASH_ENV +If this variable is set when Bash is invoked to execute a shell +script, its value is expanded and used as the name of a startup file +to read before executing the script. @xref{Bash Startup Files}. + @item TIMEFORMAT The value of this parameter is used as a format string specifying how the timing information for pipelines prefixed with the @code{time} @@ -4002,7 +4022,9 @@ the form @var{MM}m@var{SS}.@var{FF}s. The value of @var{p} determines whether or not the fraction is included. If this variable is not set, bash acts as if it had the value +@example @code{$'\nreal\t%3lR\nuser\t%3lU\nsys\t%3lS'}. +@end example If the value is null, no timing information is displayed. A trailing newline is added when the format string is displayed. @@ -4086,6 +4108,10 @@ The numeric real user id of the current user. @item EUID The numeric effective user id of the current user. +@item GROUPS +An array variable containing the list of groups of which the current +user is a member. + @item PPID The process id of the shell's parent process. @@ -4184,7 +4210,7 @@ The value of @code{MACHTYPE}. @item SHLVL Incremented by one each time a new instance of Bash is started. This is -intended to be an account of how deeply your Bash shells are nested. +intended to be a count of how deeply your Bash shells are nested. @item OPTERR If set to the value 1, Bash displays error messages @@ -4198,9 +4224,13 @@ selected with a variable starting with @code{LC_}. This variable overrides the value of @code{LANG} and any other @code{LC_} variable specifying a locale category. +@item LC_COLLATE +This variable determines the collation order used when sorting the +results of filename expansion (@pxref{Filename Expansion}). + @item LC_MESSAGES This variable determines the locale used to translate double-quoted -strings preceded by a @samp{$}. +strings preceded by a @samp{$} (@pxref{Locale Translation}). @item IGNOREEOF Controls the action of the shell on receipt of an @code{EOF} character @@ -4608,14 +4638,6 @@ the POSIX.2 standard, and include things like passing incorrect options, redirection errors, variable assignment errors for assignments preceding the command name, and so on. -@ignore -@item -The environment passed to executed commands is not sorted. Neither is -the output of @code{set}. This is not strictly Posix.2 behavior, but -@code{sh} does it this way. @code{ksh} does not. It's not necessary to -sort the environment; no program should rely on it being sorted. -@end ignore - @item If the @code{cd} builtin finds a directory to change to using @code{$CDPATH}, the @@ -4641,6 +4663,10 @@ Process substitution is not available. Assignment statements preceding @sc{POSIX.2} @code{special} builtins persist in the shell environment after the builtin completes. +@item +The @code{export} and @code{readonly} builtin commands display their +output in the format required by @sc{POSIX.2}. + @end enumerate There is other @sc{POSIX.2} behavior that Bash does not implement. @@ -4826,9 +4852,10 @@ kill [-s @var{sigspec}] [-n @var{signum}] [-@var{sigspec}] @var{jobspec} kill -l [@var{sigspec}] @end example Send a signal specified by @var{sigspec} or @var{signum} to the process -named by @var{jobspec}. @var{sigspec} is either a signal name such as -@code{SIGINT} or a signal number; @var{signum} is a signal number. If -@var{sigspec} and @var{signum} are not present, @code{SIGTERM} is used. +named by @var{jobspec}. +@var{sigspec} is either a signal name such as @code{SIGINT} (with or without +the @code{SIG} prefix) or a signal number; @var{signum} is a signal number. +If @var{sigspec} and @var{signum} are not present, @code{SIGTERM} is used. The @samp{-l} option lists the signal names, or the signal name corresponding to @var{sigspec}. @@ -4878,8 +4905,8 @@ supplied process @sc{ID}s. This variable controls how the shell interacts with the user and job control. If this variable exists then single word simple commands without redirects are treated as candidates for resumption -of an existing job. There is no ambiguity allowed; if you have -more than one job beginning with the string that you have typed, then +of an existing job. There is no ambiguity allowed; if there is +more than one job beginning with the string typed, then the most recently accessed job will be selected. The name of a stopped job, in this context, is the command line used to start it. If this variable is set to the value @samp{exact}, @@ -4912,7 +4939,7 @@ version of Unix (and, someday, @sc{GNU}). Other independent ports exist for @sc{OS/2}, Windows 95, and Windows @sc{NT}. @menu -* Basic Installation:: Generic installation instructions. +* Basic Installation:: Installation instructions. * Compilers and Options:: How to set special options for various systems. @@ -4941,7 +4968,7 @@ version of Unix (and, someday, @sc{GNU}). Other independent ports exist for @cindex Bash installation @cindex Bash configuration -These are generic installation instructions for Bash. +These are installation instructions for Bash. The @code{configure} shell script attempts to guess correct values for various system-dependent variables used during @@ -4969,8 +4996,17 @@ The file @file{configure.in} is used to create @code{configure} by a program called Autoconf. You only need @file{configure.in} if you want to change it or regenerate @code{configure} using a newer version of Autoconf. If -you do this, make sure you are using Autoconf version 2.9 or -newer. +you do this, make sure you are using Autoconf version 2.10 or +newer. + +If you need to change @file{configure.in} or regenerate +@code{configure}, you will need to create two files: +@file{_distribution} and @file{_patchlevel}. @file{_distribution} +should contain the major and minor version numbers of the Bash +distribution, for example @samp{2.01}. @file{_patchlevel} should +contain the patch level of the Bash distribution, @samp{0} for +example. The script @file{support/mkconffiles} has been provided +to automate the creation of these files. The simplest way to compile Bash is: @@ -5153,6 +5189,19 @@ Here is a complete list of the @samp{--enable-} and @samp{--with-} options that the Bash @code{configure} recognizes. @table @code +@item --with-afs +Define if you are using the Andrew File System from Transarc. + +@item --with-curses +Use the curses library instead of the termcap library. This should +be supplied if your system has an inadequate or incomplete termcap +database. + +@item --with-glibc-malloc +Use the @sc{GNU} libc version of @code{malloc} in +@file{lib/malloc/gmalloc.c}. This is somewhat slower than the +default @code{malloc}, but wastes considerably less space. + @item --with-gnu-malloc Use the @sc{GNU} version of @code{malloc} in @file{lib/malloc/malloc.c}. This is not the same @@ -5160,15 +5209,8 @@ Use the @sc{GNU} version of derived from the 4.2 @sc{BSD} @code{malloc}. This @code{malloc} is very fast, but wastes a lot of space. This option is enabled by default. The @file{NOTES} file contains a list of systems for -which this should be turned off. - -@item --with-glibc-malloc -Use the @sc{GNU} libc version of @code{malloc} in -@file{lib/malloc/gmalloc.c}. This is somewhat slower than the -default @code{malloc}, but wastes considerably less space. - -@item --with-afs -Define if you are using the Andrew File System from Transarc. +which this should be turned off, and @code{configure} disables this +option automatically for a number of systems. @item --with-purify Define this to use the Purify memory allocation checker from Pure @@ -5190,32 +5232,48 @@ enabled by default, unless the operating system does not provide the necessary support. @table @code -@item --enable-job-control -This enables job control features, if the @sc{OS} supports them. - @item --enable-alias Allow alias expansion and include the @code{alias} and @code{unalias} builtins. -@item --enable-readline -Include support for command-line editing and history with the Bash -version of the Readline library. - -@item --enable-history -Include command history and the @code{fc} and @code{history} -builtin commands. +@item --enable-array-variables +Include support for one-dimensional array shell variables. @item --enable-bang-history Include support for @code{csh}-like history substitution. +@item --enable-brace-expansion +Include @code{csh}-like brace expansion +( @code{b@{a,b@}c} @expansion{} @code{bac bbc} ). + +@item --enable-command-timing +Include support for recognizing @code{time} as a reserved word and for +displaying timing statistics for the pipeline following @code{time}. This +allows pipelines as well as shell builtins and functions to be timed. + @item --enable-directory-stack Include support for a @code{csh}-like directory stack and the @code{pushd}, @code{popd}, and @code{dirs} builtins. -@item --enable-restricted -Include support for a @dfn{restricted shell}. If this is enabled, Bash, -when called as @code{rbash}, enters a restricted mode. See -@ref{The Restricted Shell}, for a description of restricted mode. +@item --enable-disabled-builtins +Allow builtin commands to be invoked via @samp{builtin xxx} +even after @code{xxx} has been disabled using @samp{enable -n xxx}. +See @ref{Bash Builtins}, for details of the @code{builtin} and +@code{enable} builtin commands. + +@item --enable-dparen-arithmetic +Include support for the @code{ksh} @code{((@dots{}))} command. + +@item --enable-help-builtin +Include the @code{help} builtin, which displays help on shell builtins and +variables. + +@item --enable-history +Include command history and the @code{fc} and @code{history} +builtin commands. + +@item --enable-job-control +This enables job control features, if the @sc{OS} supports them. @item --enable-process-substitution This enables process substitution (@pxref{Process Substitution}) if @@ -5226,35 +5284,19 @@ Turn on the interpretation of a number of backslash-escaped characters in the @code{$PS1}, @code{$PS2}, @code{$PS3}, and @code{$PS4} prompt strings. +@item --enable-readline +Include support for command-line editing and history with the Bash +version of the Readline library. + +@item --enable-restricted +Include support for a @dfn{restricted shell}. If this is enabled, Bash, +when called as @code{rbash}, enters a restricted mode. See +@ref{The Restricted Shell}, for a description of restricted mode. + @item --enable-select Include the @code{ksh} @code{select} builtin, which allows the generation of simple menus. -@item --enable-help-builtin -Include the @code{help} builtin, which displays help on shell builtins and -variables. - -@item --enable-array-variables -Include support for one-dimensional array shell variables. - -@item --enable-dparen-arithmetic -Include support for the @code{ksh} @code{((@dots{}))} command. - -@item --enable-brace-expansion -Include @code{csh}-like brace expansion -( @code{b@{a,b@}c} @expansion{} @code{bac bbc} ). - -@item --enable-disabled-builtins -Allow builtin commands to be invoked via @samp{builtin xxx} -even after @code{xxx} has been disabled using @samp{enable -n xxx}. -See @ref{Bash Builtins}, for details of the @code{builtin} and -@code{enable} builtin commands. - -@item --enable-command-timing -Include support for recognizing @code{time} as a reserved word and for -displaying timing statistics for the pipeline following @code{time}. This -allows pipelines as well as shell builtins and functions to be timed. - @item --enable-usg-echo-default Make the @code{echo} builtin expand backslash-escaped characters by default, without requiring the @samp{-e} option. This makes the Bash @code{echo} @@ -5280,7 +5322,7 @@ version of Bash that you have. Once you have determined that a bug actually exists, use the @code{bashbug} command to submit a bug report. -If you have a fix, you are welcome to mail that as well! +If you have a fix, you are encouraged to mail that as well! Suggestions and `philosophical' bug reports may be mailed to @code{bug-bash@@prep.ai.MIT.Edu} or posted to the Usenet newsgroup @code{gnu.bash.bug}. diff --git a/doc/readline.3 b/doc/readline.3 index e122cb7..3d16168 100644 --- a/doc/readline.3 +++ b/doc/readline.3 @@ -6,9 +6,9 @@ .\" Case Western Reserve University .\" chet@ins.CWRU.Edu .\" -.\" Last Change: Mon Jul 8 13:07:48 EDT 1996 +.\" Last Change: Wed Feb 5 14:13:22 EST 1997 .\" -.TH READLINE 3 "1996 July 8" GNU +.TH READLINE 3 "1997 Feb 5" GNU .\" .\" File Name macro. This used to be `.PN', for Path Name, .\" but Sun doesn't seem to like that very much. @@ -682,9 +682,18 @@ Add this digit to the argument already accumulating, or start a new argument. M\-\- starts a negative argument. .TP .B universal\-argument -Each time this is executed, the argument count is multiplied by four. +This is another way to specify an argument. +If this command is followed by one or more digits, optionally with a +leading minus sign, those digits define the argument. +If the command is followed by digits, executing +.B universal\-argument +again ends the numeric argument, but is otherwise ignored. +As a special case, if this command is immediately followed by a +character that is neither a digit or minus sign, the argument count +for the next command is multiplied by four. The argument count is initially one, so executing this function the -first time makes the argument count four. +first time makes the argument count four, a second time makes the +argument count sixteen, and so on. .PD .SS Completing .PP |
