diff options
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/FAQ | 103 | ||||
| -rw-r--r-- | doc/article.ps | 1418 | ||||
| -rw-r--r-- | doc/bash.1 | 261 | ||||
| -rw-r--r-- | doc/bashref.info | 982 | ||||
| -rw-r--r-- | doc/bashref.texi | 362 | ||||
| -rw-r--r-- | doc/rose94.ps | 1581 | ||||
| -rw-r--r-- | doc/version.texi | 12 |
7 files changed, 4062 insertions, 657 deletions
@@ -1,4 +1,4 @@ -This is the Bash FAQ, version 3.27, for Bash version 3.0. +This is the Bash FAQ, version 3.32, for Bash version 3.1. This document contains a set of frequently-asked questions concerning Bash, the GNU Bourne-Again Shell. Bash is a freely-available command @@ -36,9 +36,9 @@ A10) What is the bash `posix mode'? Section B: The latest version -B1) What's new in version 3.0? -B2) Are there any user-visible incompatibilities between bash-3.0 and - bash-1.14.7? +B1) What's new in version 3.1? +B2) Are there any user-visible incompatibilities between bash-3.1 and + bash-2.05b? Section C: Differences from other Unix shells @@ -140,22 +140,26 @@ of Case Western Reserve University. A2) What's the latest version? -The latest version is 3.0, first made available on 27 July, 2004. +The latest version is 3.1, first made available on 09 December, 2005. A3) Where can I get it? Bash is the GNU project's shell, and so is available from the master GNU archive site, ftp.gnu.org, and its mirrors. The latest version is also available for FTP from ftp.cwru.edu. -The following URLs tell how to get version 3.0: +The following URLs tell how to get version 3.1: -ftp://ftp.gnu.org/pub/gnu/bash/bash-3.0.tar.gz -ftp://ftp.cwru.edu/pub/bash/bash-3.0.tar.gz +ftp://ftp.gnu.org/pub/gnu/bash/bash-3.1.tar.gz +ftp://ftp.cwru.edu/pub/bash/bash-3.1.tar.gz Formatted versions of the documentation are available with the URLs: -ftp://ftp.gnu.org/pub/gnu/bash/bash-doc-3.0.tar.gz -ftp://ftp.cwru.edu/pub/bash/bash-doc-3.0.tar.gz +ftp://ftp.gnu.org/pub/gnu/bash/bash-doc-3.1.tar.gz +ftp://ftp.cwru.edu/pub/bash/bash-doc-3.1.tar.gz + +Any patches for the current version are available with the URL: + +ftp://ftp.cwru.edu/pub/bash/bash-3.1-patches/ A4) On what machines will bash run? @@ -181,16 +185,15 @@ earlier Minix versions yet. Bash has been ported to versions of Windows implementing the Win32 programming interface. This includes Windows 95 and Windows NT. -The port was done by Cygnus Solutions as part of their CYGWIN -project. For more information about the project, look at the URLs - -http://www.cygwin.com/ -http://sourceware.cygnus.com/cygwin +The port was done by Cygnus Solutions (now part of Red Hat) as part +of their CYGWIN project. For more information about the project, see +http://www.cygwin.com/. Cygnus originally ported bash-1.14.7, and that port was part of their -early GNU-Win32 (the original name) releases. Cygnus has also done a -port of bash-2.05 to the CYGWIN environment, and it is available as -part of their current release. +early GNU-Win32 (the original name) releases. Cygnus has also done +ports of bash-2.05b and bash-3.0 to the CYGWIN environment, and both +are available as part of their current release. Bash-3.1 is currently +being tested and should be available soon. Bash-2.05b and later versions should require no local Cygnus changes to build and run under CYGWIN. @@ -212,7 +215,8 @@ ftp://ftp.simtel.net/pub/simtelnet/gnu/djgpp/v2gnu/bsh204s.zip source Mark began to work with bash-2.05, but I don't know the current status. Bash-3.0 compiles and runs with no modifications under Microsoft's Services -for Unix (SFU), once known as Interix. +for Unix (SFU), once known as Interix. I do not anticipate any problems +with building bash-3.1. A6) How can I build bash with gcc? @@ -381,15 +385,25 @@ They are also listed in a section in the Bash Reference Manual Section B: The latest version -B1) What's new in version 3.0? +B1) What's new in version 3.1? + +Bash-3.1 is the first maintenance release of the third major release of +bash. It contains the following significant new features (see the manual +page for complete descriptions and the CHANGES and NEWS files in the +bash-3.1 distribution). + +o Bash-3.1 may now be configured and built in a mode that enforces strict + POSIX compliance. -Bash-3.0 is the third major release of bash. The features introduced -in the intermediate releases following bash-2.05 have been completed. -Support for the bash debugger (a separate project) has been integrated. +o The `+=' assignment operator, which appends to the value of a string or + array variable, has been implemented. -Bash-3.0 contains the following new features (see the manual page for -complete descriptions and the CHANGES and NEWS files in the bash-3.0 -distribution): +o It is now possible to ignore case when matching in contexts other than + filename generation using the new `nocasematch' shell option. + +A short feature history dating from Bash-2.0: + +Bash-3.0 contained the following new features: o Features to support the bash debugger have been implemented, and there is a new `extdebug' option to turn the non-default options on @@ -419,8 +433,6 @@ o The `jobs', `kill', and `wait' builtins now accept job control notation o The `gettext' package and libintl have been integrated, and the shell messages may be translated into other languages -A short feature history dating from Bash-2.0: - Bash-2.05b introduced the following new features: o support for multibyte characters has been added to both bash and readline @@ -628,10 +640,10 @@ grammar tighter and smaller (66 reduce-reduce conflicts gone) lots of code now smaller and faster test suite greatly expanded -B2) Are there any user-visible incompatibilities between bash-3.0 and - bash-1.14.7? +B2) Are there any user-visible incompatibilities between bash-3.1 and + bash-2.05b? -There are a few incompatibilities between version 1.14.7 and version 3.0. +There are a few incompatibilities between version 2.05b and version 3.1. They are detailed in the file COMPAT in the bash distribution. That file is not meant to be all-encompassing; send mail to bash-maintainers@gnu.org if if you find something that's not mentioned there. @@ -714,11 +726,12 @@ Things bash has that sh does not: case-insensitive pattern matching and globbing variable assignments preceding commands affect only that command, even for builtins and functions - posix mode + posix mode and strict posix conformance redirection to /dev/fd/N, /dev/stdin, /dev/stdout, /dev/stderr, /dev/tcp/host/port, /dev/udp/host/port debugger support, including `caller' builtin and new variables RETURN trap + the `+=' assignment operator Things sh has that bash does not: @@ -796,6 +809,7 @@ Things bash has or uses that ksh88 does not: RETURN trap Timestamps in history entries {x..y} brace expansion + The `+=' assignment operator Things ksh88 has or uses that bash does not: tracked aliases (alias -t) @@ -842,7 +856,6 @@ New things in ksh-93 not in bash-3.0: `fc' has been renamed to `hist' `.' can execute shell functions exit statuses between 0 and 255 - `+=' variable assignment operator FPATH and PATH mixing getopts -a -I invocation option @@ -876,6 +889,7 @@ New things in ksh-93 present in bash-3.0: command name completion ENV processed only for interactive shells set -o pipefail + The `+=' assignment operator Section D: Why does bash do some things differently than other Unix shells? @@ -1099,9 +1113,8 @@ 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. -You can build a version of bash that will not report SIGPIPE errors -by uncommenting the definition of DONT_REPORT_SIGPIPE in the file -config-top.h. +As of bash-3.1, bash will not report SIGPIPE errors by default. You +can build a version of bash that will report such errors. E3) When I have terminal escape sequences in my prompt, why does bash wrap lines at the wrong column? @@ -1128,12 +1141,12 @@ simple calls to `read'. For example, piping a command's output into a `while' loop that repeatedly calls `read' will result in the same behavior. -Each element of a pipeline runs in a separate process, a child of -the shell running the pipeline. A subprocess cannot affect its -parent's environment. When the `read' command sets the variable -to the input, that variable is set only in the subshell, not the -parent shell. When the subshell exits, the value of the variable -is lost. +Each element of a pipeline, even a builtin or shell function, +runs in a separate process, a child of the shell running the +pipeline. A subprocess cannot affect its parent's environment. +When the `read' command sets the variable to the input, that +variable is set only in the subshell, not the parent shell. When +the subshell exits, the value of the variable is lost. Many pipelines that end with `read variable' can be converted into command substitutions, which will capture the output of @@ -1763,21 +1776,19 @@ These are features that may or may not appear in a future version of bash. breaking some of the shell functionality into embeddable libraries a module system like zsh's, using dynamic loading like builtins -date-stamped command history a bash programmer's guide with a chapter on creating loadable builtins a better loadable interface to perl with access to the shell builtins and variables (contributions gratefully accepted) ksh93-like `nameref' variables -ksh93-like `+=' variable assignment operator ksh93-like `xx.yy' variables (including some of the .sh.* variables) and associated disipline functions Some of the new ksh93 pattern matching operators, like backreferencing H5) When will the next release appear? -The next version will appear sometime in 2005. Never make predictions. +The next version will appear sometime in 2006. Never make predictions. -This document is Copyright 1995-2004 by Chester Ramey. +This document is Copyright 1995-2005 by Chester Ramey. Permission is hereby granted, without written agreement and without license or royalty fees, to use, copy, and distribute diff --git a/doc/article.ps b/doc/article.ps new file mode 100644 index 0000000..3aadf2f --- /dev/null +++ b/doc/article.ps @@ -0,0 +1,1418 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.16.1 +%%CreationDate: Mon Nov 19 13:06:55 2001 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Italic +%%+ font Times-Roman +%%+ font Courier +%%DocumentSuppliedResources: procset grops 1.16 1 +%%Pages: 11 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.16 1 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/MANUAL{ +statusdict begin/manualfeed true store end +}bind def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Italic +%%IncludeResource: font Times-Roman +%%IncludeResource: font Courier +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 +def/PL 792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron +/scaron/zcaron/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/space/exclam/quotedbl/numbersign/dollar/percent +/ampersand/quoteright/parenleft/parenright/asterisk/plus/comma/hyphen +/period/slash/zero/one/two/three/four/five/six/seven/eight/nine/colon +/semicolon/less/equal/greater/question/at/A/B/C/D/E/F/G/H/I/J/K/L/M/N/O +/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash/bracketright/circumflex +/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q/r/s/t/u/v/w/x/y +/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase/guillemotleft +/guillemotright/bullet/florin/fraction/perthousand/dagger/daggerdbl +/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen +/brokenbar/section/dieresis/copyright/ordfeminine/guilsinglleft +/logicalnot/minus/registered/macron/degree/plusminus/twosuperior +/threesuperior/acute/mu/paragraph/periodcentered/cedilla/onesuperior +/ordmasculine/guilsinglright/onequarter/onehalf/threequarters +/questiondown/Agrave/Aacute/Acircumflex/Atilde/Adieresis/Aring/AE +/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute/Icircumflex +/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn +/germandbls/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla +/egrave/eacute/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis +/eth/ntilde/ograve/oacute/ocircumflex/otilde/odieresis/divide/oslash +/ugrave/uacute/ucircumflex/udieresis/yacute/thorn/ydieresis]def +/Courier@0 ENC0/Courier RE/Times-Roman@0 ENC0/Times-Roman RE +/Times-Italic@0 ENC0/Times-Italic RE/Times-Bold@0 ENC0/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 12/Times-Bold@0 SF(Bash \255 The GNU shell*)227.904 123 Q/F1 10 +/Times-Italic@0 SF(Chet Rame)263.85 147 Q(y)-.3 E(Case W)221.72 159 Q +(estern Reserve Univer)-.92 E(sity)-.1 E -.15(ch)250.425 171 S +(et@po.cwru.edu).15 E/F2 10/Times-Bold@0 SF 2.5(1. Intr)72 207 R +(oduction)-.18 E(Bash)97 222.6 Q/F3 10/Times-Roman@0 SF .904 +(is the shell, or command language interpreter)3.404 F 3.404(,t)-.4 G +.904(hat will appear in the GNU operating system.)-3.404 F 1.075 +(The name is an acron)72 234.6 R 1.075(ym for the \231Bourne-Ag)-.15 F +1.075(ain SHell\232, a pun on Ste)-.05 F 1.375 -.15(ve B)-.25 H 1.075 +(ourne, the author of the direct).15 F .206(ancestor of the current)72 +246.6 R/F4 8/Times-Roman@0 SF(UNIX)2.706 E F3 2.706<ae73>C(hell)-2.706 E +F1(/bin/sh)2.706 E F3 2.706(,w)C .205(hich appeared in the Se)-2.706 F +-.15(ve)-.25 G .205(nth Edition Bell Labs Research v).15 F(er)-.15 E(-) +-.2 E(sion of)72 258.6 Q/F5 9/Times-Roman@0 SF(UNIX)2.5 E F3(.)A .387 +(Bash is an)97 274.2 R F2(sh)2.887 E F3 .387 +(\255compatible shell that incorporates useful features from the K)B +.388(orn shell \()-.35 F F2(ksh)A F3 2.888(\)a)C .388(nd the C)-2.888 F +.023(shell \()72 286.2 R F2(csh)A F3 .023 +(\), described later in this article.)B .022 +(It is ultimately intended to be a conformant implementation of the) +5.022 F 3.568(IEEE POSIX Shell and Utilities speci\214cation \(IEEE W)72 +298.2 R 3.568(orking Group 1003.2\).)-.8 F 3.569(It of)8.569 F 3.569 +(fers functional)-.25 F(impro)72 310.2 Q -.15(ve)-.15 G(ments o).15 E +-.15(ve)-.15 G 2.5(rs).15 G 2.5(hf)-2.5 G(or both interacti)-2.5 E .3 +-.15(ve a)-.25 H(nd programming use.).15 E .697 +(While the GNU operating system will most lik)97 325.8 R .697 +(ely include a v)-.1 F .697(ersion of the Berk)-.15 F(ele)-.1 E 3.197 +(ys)-.15 G .696(hell csh, Bash)-3.197 F .015(will be the def)72 337.8 R +.015(ault shell.)-.1 F(Lik)5.015 E 2.515(eo)-.1 G .015(ther GNU softw) +-2.515 F .016(are, Bash is quite portable.)-.1 F .016 +(It currently runs on nearly e)5.016 F -.15(ve)-.25 G(ry).15 E -.15(ve) +72 349.8 S .523(rsion of).15 F F4(UNIX)3.023 E F3 .523(and a fe)3.023 F +3.023(wo)-.25 G .523 +(ther operating systems \255 an independently-supported port e)-3.023 F +.523(xists for OS/2, and)-.15 F .706 +(there are rumors of ports to DOS and W)72 361.8 R(indo)-.4 E .706 +(ws NT)-.25 F 5.706(.P)-.74 G .706(orts to)-5.706 F F5(UNIX)3.206 E F3 +(-lik)A 3.206(es)-.1 G .706(ystems such as QNX and Minix)-3.206 F +(are part of the distrib)72 373.8 Q(ution.)-.2 E .405 +(The original author of Bash w)97 389.4 R .405(as Brian F)-.1 F .405 +(ox, an emplo)-.15 F .405(yee of the Free Softw)-.1 F .405(are F)-.1 F +2.905(oundation. The)-.15 F(cur)2.905 E(-)-.2 E(rent de)72 401.4 Q -.15 +(ve)-.25 G(loper and maintainer is Chet Rame).15 E 1.3 -.65(y, a v)-.15 +H(olunteer who w).45 E(orks at Case W)-.1 E(estern Reserv)-.8 E 2.5(eU) +-.15 G(ni)-2.5 E -.15(ve)-.25 G(rsity).15 E(.)-.65 E F2 2.5(2. What')72 +425.4 R 2.5(sP)-.37 G(OSIX, anyway?)-2.5 E F1(POSIX)97 441 Q F3 .343 +(is a name originally coined by Richard Stallman for a f)2.843 F .343 +(amily of open system standards based)-.1 F(on)72 453 Q F5(UNIX)3.24 E +F3 5.74(.T)C .74(here are a number of aspects of)-5.74 F F5(UNIX)3.24 E +F3 .74(under consideration for standardization, from the basic)3.24 F +.192(system services at the system call and C library le)72 465 R -.15 +(ve)-.25 G 2.692(lt).15 G 2.692(oa)-2.692 G .192 +(pplications and tools to system administration and)-2.692 F 2.5 +(management. Each)72 477 R(area of standardization is assigned to a w) +2.5 E(orking group in the 1003 series.)-.1 E 2.814 +(The POSIX Shell and Utilities standard has been de)97 492.6 R -.15(ve) +-.25 G 2.814(loped by IEEE W).15 F 2.813(orking Group 1003.2)-.8 F .254 +(\(POSIX.2\).\210 It concentrates on the command interpreter interf)72 +504.6 R .253(ace and utility programs commonly e)-.1 F -.15(xe)-.15 G +(cuted).15 E 1.112(from the command line or by other programs.)72 516.6 +R 1.112(An initial v)6.112 F 1.113 +(ersion of the standard has been appro)-.15 F -.15(ve)-.15 G 3.613(da) +.15 G(nd)-3.613 E .365(published by the IEEE, and w)72 528.6 R .365 +(ork is currently underw)-.1 F .365(ay to update it.)-.1 F .365 +(There are four primary areas of w)5.365 F(ork)-.1 E +(in the 1003.2 standard:)72 540.6 Q 21.5<8341>72 556.2 S .835 +(spects of the shell')-21.5 F 3.335(ss)-.55 G .835 +(yntax and command language.)-3.335 F 3.335(An)5.835 G .835 +(umber of special b)-3.335 F .835(uiltins such as)-.2 F F2(cd)3.335 E F3 +(and)3.335 E F2(exec)97 568.2 Q F3 .545(are being speci\214ed as part o\ +f the shell, since their functionality usually cannot be implemented) +3.046 F(by a separate e)97 580.2 Q -.15(xe)-.15 G(cutable;).15 E 21.5 +<8341>72 595.8 S .926 +(set of utilities to be called by shell scripts and applications.) +-18.074 F .927(Examples are programs lik)5.927 F(e)-.1 E F1 .927 +(sed, tr)3.427 F(,)-1.11 E F3(and)97 607.8 Q F1(awk.)2.797 E F3 .297 +(Utilities commonly implemented as shell b)5.297 F .296 +(uiltins are described in this section, such as)-.2 F F2(test)2.796 E F3 +(and)97 619.8 Q F2(kill)3.422 E F3 5.922(.A)C 3.422(ne)-5.922 G .922 +(xpansion of this section')-3.572 F 3.423(ss)-.55 G .923 +(cope, termed the User Portability Extension, or UPE, has)-3.423 F +(standardized interacti)97 631.8 Q .3 -.15(ve p)-.25 H(rograms such as) +.15 E F1(vi)2.5 E F3(and)2.5 E F1(mailx;)2.5 E F3 21.5<8341>72 647.4 S +.288(group of functional interf)-18.712 F .287(aces to services pro)-.1 +F .287(vided by the shell, such as the traditional)-.15 F/F6 10 +/Courier@0 SF(system\(\))2.787 E F3 3.289(Cl)97 659.4 S .789 +(ibrary function.)-3.289 F .789(There are functions to perform shell w) +5.789 F .789(ord e)-.1 F .79(xpansions, perform \214lename e)-.15 F +(xpan-)-.15 E .324(sion \()97 671.4 R F1(globbing)A F3 .324 +(\), obtain v)B .323(alues of POSIX.2 system con\214guration v)-.25 F +.323(ariables, retrie)-.25 F .623 -.15(ve v)-.25 H .323(alues of en)-.1 +F(viron-)-.4 E(ment v)97 683.4 Q(ariables \()-.25 E F6(getenv\(\))A F3 +(\), and other services;).833 E .32 LW 144 691.4 72 691.4 DL F4 +(*An earlier v)72 703.2 Q +(ersion of this article appeared in The Linux Journal.)-.12 E(\210IEEE,) +72 715 Q/F7 8/Times-Italic@0 SF 1.231(IEEE Standar)3.231 F 3.231(df) +-.296 G 1.231(or Information T)-3.231 F(ec)-.736 E(hnolo)-.12 E 1.231 +(gy -- P)-.08 F 1.231(ortable Oper)-.64 F 1.232 +(ating System Interface \(POSIX\) P)-.12 F 1.232(art 2:)-.64 F +(Shell and Utilities)72 725 Q F4 2(,1)C(992.)-2 E EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(-2-)282.17 48 Q 21.5<8341>72 84 S +(suite of \231de)-19 E -.15(ve)-.25 G(lopment\232 utilities such as).15 +E/F1 10/Times-Italic@0 SF(c89)2.5 E F0(\(the POSIX.2 v)2.5 E(ersion of) +-.15 E F1(cc)2.5 E F0(\), and)A F1(yacc.)2.5 E F0 .483 +(Bash is concerned with the aspects of the shell')97 99.6 R 2.983(sb) +-.55 G(eha)-2.983 E .484(vior de\214ned by POSIX.2.)-.2 F .484 +(The shell command)5.484 F 1.439 +(language has of course been standardized, including the basic \215o)72 +111.6 R 3.938(wc)-.25 G 1.438(ontrol and program e)-3.938 F -.15(xe)-.15 +G 1.438(cution con-).15 F 1.284 +(structs, I/O redirection and pipelining, ar)72 123.6 R 1.284 +(gument handling, v)-.18 F 1.284(ariable e)-.25 F 1.284 +(xpansion, and quoting.)-.15 F(The)6.285 E F1(special)3.785 E F0 -.2(bu) +72 135.6 S .676 +(iltins, which must be implemented as part of the shell to pro).2 F .676 +(vide the desired functionality)-.15 F 3.176(,a)-.65 G .676 +(re speci\214ed)-3.176 F .7(as being part of the shell; e)72 147.6 R .7 +(xamples of these are)-.15 F/F2 10/Times-Bold@0 SF -2.3 -.15(ev a)3.201 +H(l).15 E F0(and)3.201 E F2(export)3.201 E F0 5.701(.O)C .701 +(ther utilities appear in the sections of)-5.701 F .256(POSIX.2 not de) +72 159.6 R -.2(vo)-.25 G .256(ted to the shell which are commonly \(and\ + in some cases must be\) implemented as b).2 F(uiltin)-.2 E .213 +(commands, such as)72 171.6 R F2 -.18(re)2.713 G(ad).18 E F0(and)2.713 E +F2(test)2.713 E F0 5.213(.P)C .213 +(OSIX.2 also speci\214es aspects of the shell')-5.213 F 2.713(si)-.55 G +(nteracti)-2.713 E .513 -.15(ve b)-.25 H(eha).15 E .214(vior as part)-.2 +F .598(of the UPE, including job control and command line editing.)72 +183.6 R .598(Interestingly enough, only)5.598 F F1(vi)3.098 E F0 .598 +(-style line edit-)B(ing commands ha)72 195.6 Q .3 -.15(ve b)-.2 H +(een standardized;).15 E F1(emacs)2.5 E F0 +(editing commands were left out due to objections.)2.5 E 1.128 +(While POSIX.2 includes much of what the shell has traditionally pro)97 +211.2 R 1.129(vided, some important things)-.15 F(ha)72 223.2 Q .344 +-.15(ve b)-.2 H .044(een omitted as being \231be).15 F .044 +(yond its scope.)-.15 F 5.043<9a54>-.7 G .043 +(here is, for instance, no mention of a dif)-5.043 F .043 +(ference between a)-.25 F F1(lo)72 235.2 Q(gin)-.1 E F0 1.445 +(shell and an)3.945 F 3.945(yo)-.15 G 1.445(ther interacti)-3.945 F +1.745 -.15(ve s)-.25 H 1.446 +(hell \(since POSIX.2 does not specify a login program\).).15 F 1.446 +(No \214x)6.446 F(ed)-.15 E(startup \214les are de\214ned, either \255 \ +the standard does not mention)72 247.2 Q F1(.pr)2.5 E(o\214le)-.45 E F0 +(.)A F2 2.5(3. Basic)72 271.2 R(Bash featur)2.5 E(es)-.18 E F0 1.448 +(Since the Bourne shell pro)97 286.8 R 1.448 +(vides Bash with most of its philosophical underpinnings, Bash inherits) +-.15 F .64(most of its features and functionality from sh.)72 298.8 R +.641(Bash implements all of the traditional sh \215o)5.641 F 3.141(wc) +-.25 G .641(ontrol con-)-3.141 F .8(structs \()72 310.8 R F1(for)A F0(,) +A F1(if)3.3 E F0(,)A F1(while)3.3 E F0 3.3(,e)C 3.3(tc.\). All)-3.3 F +.799(of the Bourne shell b)3.3 F .799 +(uiltins, including those not speci\214ed in the POSIX.2)-.2 F .536 +(standard, appear in Bash.)72 322.8 R(Shell)5.536 E F1(functions)3.036 E +F0 3.036(,i)C .536(ntroduced in the SVR2 v)-3.036 F .537 +(ersion of the Bourne shell, are similar)-.15 F .779 +(to shell scripts, b)72 334.8 R .779 +(ut are de\214ned using a special syntax and are e)-.2 F -.15(xe)-.15 G +.779(cuted in the same process as the calling).15 F 2.841(shell. Bash)72 +346.8 R .341(has shell functions which beha)2.841 F .641 -.15(ve i)-.2 H +2.841(naf).15 G .341(ashion upw)-2.941 F .342 +(ard-compatible with sh functions.)-.1 F .342(There are)5.342 F 1.447 +(certain shell v)72 358.8 R 1.446 +(ariables that Bash interprets in the same w)-.25 F 1.446 +(ay as sh, such as)-.1 F F2(PS1)3.946 E F0(,)A F2(IFS)3.946 E F0 3.946 +(,a)C(nd)-3.946 E F2 -.74(PA)3.946 G(TH)-.21 E F0 6.446(.B)C(ash)-6.446 +E 1.423(implements essentially the same grammar)72 370.8 R 3.924(,p)-.4 +G 1.424(arameter and v)-3.924 F 1.424(ariable e)-.25 F 1.424 +(xpansion semantics, redirection, and)-.15 F 1.06 +(quoting as the Bourne shell.)72 382.8 R 1.06(Where dif)6.06 F 1.06 +(ferences appear between the POSIX.2 standard and traditional sh)-.25 F +(beha)72 394.8 Q(vior)-.2 E 2.5(,B)-.4 G(ash follo)-2.5 E(ws POSIX.)-.25 +E 1.608(The K)97 410.4 R 1.608(orn Shell \()-.35 F F2(ksh)A F0 4.108 +(\)i)C 4.108(sad)-4.108 G 1.608 +(escendent of the Bourne shell written at A)-4.108 F 1.609 +(T&T Bell Laboratories by)-1.11 F(Da)72 422.4 Q 1.059(vid K)-.2 F 3.559 +(orn\207. It)-.35 F(pro)3.559 E 1.059 +(vides a number of useful features that POSIX and Bash ha)-.15 F 1.359 +-.15(ve a)-.2 H 3.558(dopted. Man).15 F 3.558(yo)-.15 G 3.558(ft)-3.558 +G(he)-3.558 E(interacti)72 434.4 Q 1.312 -.15(ve f)-.25 H 1.012 +(acilities in POSIX.2 ha).05 F 1.312 -.15(ve t)-.2 H 1.012 +(heir roots in the ksh: for e).15 F 1.013 +(xample, the POSIX and ksh job control)-.15 F -.1(fa)72 446.4 S .513 +(cilities are nearly identical. Bash includes features from the K).1 F +.513(orn Shell for both interacti)-.35 F .813 -.15(ve u)-.25 H .513 +(se and shell).15 F 3.905(programming. F)72 458.4 R 1.405 +(or programming, Bash pro)-.15 F 1.405(vides v)-.15 F 1.405 +(ariables such as)-.25 F F2(RANDOM)3.905 E F0(and)3.905 E F2(REPL)3.905 +E(Y)-.92 E F0 3.905(,t)C(he)-3.905 E F2(typeset)3.905 E F0 -.2(bu)72 +470.4 S .398(iltin, the ability to remo).2 F .698 -.15(ve s)-.15 H .398 +(ubstrings from v).15 F .398 +(ariables based on patterns, and shell arithmetic.)-.25 F F2(RANDOM) +5.397 E F0 -.15(ex)72 482.4 S .489 +(pands to a random number each time it is referenced; assigning a v).15 +F .49(alue to)-.25 F F2(RANDOM)2.99 E F0 .49(seeds the random)2.99 F +.055(number generator)72 494.4 R(.)-.55 E F2(REPL)5.055 E(Y)-.92 E F0 +.054(is the def)2.554 F .054(ault v)-.1 F .054(ariable used by the)-.25 +F F2 -.18(re)2.554 G(ad).18 E F0 -.2(bu)2.554 G .054(iltin when no v).2 +F .054(ariable names are sup-)-.25 F .742(plied as ar)72 506.4 R 3.243 +(guments. The)-.18 F F2(typeset)3.243 E F0 -.2(bu)3.243 G .743 +(iltin is used to de\214ne v).2 F .743(ariables and gi)-.25 F 1.043 -.15 +(ve t)-.25 H .743(hem attrib).15 F .743(utes such as)-.2 F F2 -.18(re) +3.243 G(ad-).18 E(only)72 518.4 Q F0 5.512(.B)C .512 +(ash arithmetic allo)-5.512 F .512(ws the e)-.25 F -.25(va)-.25 G .511 +(luation of an e).25 F .511 +(xpression and the substitution of the result.)-.15 F .511(Shell v)5.511 +F(ari-)-.25 E .222 +(ables may be used as operands, and the result of an e)72 530.4 R .222 +(xpression may be assigned to a v)-.15 F 2.722(ariable. Nearly)-.25 F +.222(all of)2.722 F(the operators from the C language are a)72 542.4 Q +-.25(va)-.2 G(ilable, with the same precedence rules:).25 E/F3 10 +/Courier@0 SF 6($e)97 560.4 S(cho $\(\(3 + 5 * 32\)\))-6 E(163)97 572.4 +Q F0 -.15(Fo)72 594 S 3.24(ri).15 G(nteracti)-3.24 E 1.04 -.15(ve u)-.25 +H .74(se, Bash implements ksh-style aliases and b).15 F .74 +(uiltins such as)-.2 F F2(fc)3.24 E F0 .74(\(discussed belo)3.24 F .74 +(w\) and)-.25 F F2(jobs)3.24 E F0(.)A .291(Bash aliases allo)72 606 R +2.791(was)-.25 G .291(tring to be substituted for a command name.)-2.791 +F(The)5.291 E 2.791(yc)-.15 G .291(an be used to create a mnemonic) +-2.791 F .568(for a)72 618 R/F4 9/Times-Roman@0 SF(UNIX)3.068 E F0 .568 +(command name \()3.068 F F3 .568(alias del=rm)B F0 .568(\), to e)B .567 +(xpand a single w)-.15 F .567(ord to a comple)-.1 F 3.067(xc)-.15 G .567 +(ommand \()-3.067 F F3(alias)A .255 +(news='xterm -g 80x45 -title trn -e trn -e -S1 -N &')72 630 R F0 .255 +(\), or to ensure that a command)B(is in)72 642 Q -.2(vo)-.4 G -.1(ke).2 +G 2.5(dw).1 G(ith a basic set of options \()-2.5 E F3 +(alias ls="/bin/ls -F")A F0(\).)A .293(The C shell \()97 657.6 R F2(csh) +A F0 .293(\)\207, originally written by Bill Jo)B 2.792(yw)-.1 G .292 +(hile at Berk)-2.792 F(ele)-.1 E 1.592 -.65(y, i)-.15 H 2.792(sw).65 G +.292(idely used and quite popular)-2.792 F 1.499(for its interacti)72 +669.6 R 1.799 -.15(ve f)-.25 H 3.999(acilities. Bash).05 F 1.499 +(includes a csh-compatible history e)3.999 F 1.5 +(xpansion mechanism \(\231! history\232\),)-.15 F .019(brace e)72 681.6 +R .018(xpansion, access to a stack of directories via the)-.15 F F2 +(pushd)2.518 E F0(,)A F2(popd)2.518 E F0 2.518(,a)C(nd)-2.518 E F2(dirs) +2.518 E F0 -.2(bu)2.518 G .018(iltins, and tilde e).2 F(xpansion,)-.15 E +1.293(to generate users' home directories.)72 693.6 R -.35(Ti)6.294 G +1.294(lde e).35 F 1.294(xpansion has also been adopted by both the K) +-.15 F 1.294(orn Shell and)-.35 F .32 LW 144 708.2 72 708.2 DL/F5 8 +/Times-Roman@0 SF(\207Morris Bolsk)72 720 Q 2(ya)-.12 G(nd Da)-2 E +(vid K)-.16 E(orn,)-.28 E/F6 8/Times-Italic@0 SF(The K)2 E +(ornShell Command and Pr)-.32 E -.08(og)-.36 G -.12(ra).08 G +(mming Langua).12 E -.08(ge)-.08 G F5 2(,P).08 G(rentice Hall, 1989.)-2 +E EP +%%Page: 3 3 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(-3-)282.17 48 Q(POSIX.2.)72 84 Q .148 +(There were certain areas in which POSIX.2 felt standardization w)97 +99.6 R .149(as necessary)-.1 F 2.649(,b)-.65 G .149(ut no e)-2.849 F +.149(xisting imple-)-.15 F 1.598(mentation pro)72 111.6 R 1.598 +(vided the proper beha)-.15 F(vior)-.2 E 6.598(.T)-.55 G 1.598(he w) +-6.598 F 1.597(orking group in)-.1 F -.15(ve)-.4 G 1.597 +(nted and standardized functionality in).15 F .674 +(these areas, which Bash implements.)72 123.6 R(The)5.674 E/F1 10 +/Times-Bold@0 SF(command)3.174 E F0 -.2(bu)3.174 G .674(iltin w).2 F +.674(as in)-.1 F -.15(ve)-.4 G .674 +(nted so that shell functions could be).15 F .996(written to replace b) +72 135.6 R .996(uiltins; it mak)-.2 F .996(es the capabilities of the b) +-.1 F .995(uiltin a)-.2 F -.25(va)-.2 G .995(ilable to the function.).25 +F .995(The reserv)5.995 F(ed)-.15 E -.1(wo)72 147.6 S 1.731 +(rd \231!\232 w).1 F 1.731(as added to ne)-.1 F -.05(ga)-.15 G 1.731 +(te the return v).05 F 1.731(alue of a command or pipeline; it w)-.25 F +1.732(as nearly impossible to)-.1 F -.15(ex)72 159.6 S .286 +(press \231if not x\232 cleanly using the sh language.).15 F .286 +(There e)5.286 F .286(xist multiple incompatible implementations of the) +-.15 F F1(test)72 171.6 Q F0 -.2(bu)3.163 G .663 +(iltin, which tests \214les for type and other attrib).2 F .664 +(utes and performs arithmetic and string comparisons.)-.2 F .5 +(POSIX considered none of these correct, so the standard beha)72 183.6 R +.5(vior w)-.2 F .5(as speci\214ed in terms of the number of)-.1 F(ar)72 +195.6 Q .412(guments to the command.)-.18 F .412(POSIX.2 dictates e) +5.412 F .412(xactly what will happen when four or fe)-.15 F .412(wer ar) +-.25 F .412(guments are)-.18 F(gi)72 207.6 Q -.15(ve)-.25 G 5.01(nt).15 +G(o)-5.01 E F1(test)5.01 E F0 5.01(,a)C 2.51(nd lea)-5.01 F -.15(ve)-.2 +G 5.01(st).15 G 2.51(he beha)-5.01 F 2.51(vior unde\214ned when more ar) +-.2 F 2.51(guments are supplied.)-.18 F 2.51(Bash uses the)7.51 F +(POSIX.2 algorithm, which w)72 219.6 Q(as concei)-.1 E -.15(ve)-.25 G +2.5(db).15 G 2.5(yD)-2.5 G -.2(av)-2.5 G(id K).2 E(orn.)-.35 E F1 2.5 +(3.1. F)72 243.6 R(eatur)-.25 E(es not in the Bour)-.18 E(ne Shell)-.15 +E F0 .718(There are a number of minor dif)97 259.2 R .719 +(ferences between Bash and the v)-.25 F .719 +(ersion of sh present on most other)-.15 F -.15(ve)72 271.2 S .874 +(rsions of).15 F/F2 9/Times-Roman@0 SF(UNIX)3.374 E F0 5.873(.T)C .873 +(he majority of these are due to the POSIX standard, b)-5.873 F .873 +(ut some are the result of Bash)-.2 F .386 +(adopting features from other shells.)72 283.2 R -.15(Fo)5.386 G 2.886 +(ri).15 G .386(nstance, Bash includes the ne)-2.886 F 2.886<7799>-.25 G +.386(!\232 reserv)-2.886 F .386(ed w)-.15 F .386(ord, the)-.1 F F1 +(command)2.886 E F0 -.2(bu)72 295.2 S .116(iltin, the ability of the).2 +F F1 -.18(re)2.616 G(ad).18 E F0 -.2(bu)2.615 G .115 +(iltin to correctly return a line ending with a backslash, symbolic ar) +.2 F(guments)-.18 E .798(to the)72 307.2 R F1(umask)3.298 E F0 -.2(bu) +3.298 G .798(iltin, v).2 F .798(ariable substring remo)-.25 F -.25(va) +-.15 G .798(l, a w).25 F .799(ay to get the length of a v)-.1 F .799 +(ariable, and the ne)-.25 F 3.299(wa)-.25 G(lgo-)-3.299 E(rithm for the) +72 319.2 Q F1(test)2.5 E F0 -.2(bu)2.5 G +(iltin from the POSIX.2 standard, none of which appear in sh.).2 E 1.225 +(Bash also implements the \231$\(...\)\232 command substitution syntax,\ + which supersedes the sh `...` con-)97 334.8 R 2.851(struct. The)72 +346.8 R .351(\231$\(...\)\232 construct e)2.851 F .351(xpands to the ou\ +tput of the command contained within the parentheses, with)-.15 F .664 +(trailing ne)72 358.8 R .664(wlines remo)-.25 F -.15(ve)-.15 G 3.164 +(d. The).15 F .664(sh syntax is accepted for backw)3.164 F .664 +(ards compatibility)-.1 F 3.164(,b)-.65 G .664 +(ut the \231$\(...\)\232 form is)-3.364 F(preferred because its quoting\ + rules are much simpler and it is easier to nest.)72 370.8 Q .772 +(The Bourne shell does not pro)97 386.4 R .772 +(vide such features as brace e)-.15 F .772 +(xpansion, the ability to de\214ne a v)-.15 F(ariable)-.25 E .283 +(and a function with the same name, local v)72 398.4 R .282 +(ariables in shell functions, the ability to enable and disable indi-) +-.25 F .547(vidual b)72 410.4 R .547 +(uiltins or write a function to replace a b)-.2 F .547 +(uiltin, or a means to e)-.2 F .547 +(xport a shell function to a child pro-)-.15 F(cess.)72 422.4 Q .32 +(Bash has closed a long-standing shell security hole by not using the)97 +438 R F1($IFS)2.82 E F0 -.25(va)2.82 G .32(riable to split each w).25 F +(ord)-.1 E 1.254(read by the shell, b)72 450 R 1.254 +(ut splitting only the results of e)-.2 F 1.255 +(xpansion \(ksh and the 4.4 BSD sh ha)-.15 F 1.555 -.15(ve \214)-.2 H +-.15(xe).15 G 3.755(dt).15 G 1.255(his as)-3.755 F 2.907(well\). Useful) +72 462 R(beha)2.907 E .407(vior such as a means to abort e)-.2 F -.15 +(xe)-.15 G .407(cution of a script read with the \231.).15 F 2.906<9a63> +-.7 G .406(ommand using the)-2.906 F F1 -.18(re)72 474 S(tur).18 E(n) +-.15 E F0 -.2(bu)2.742 G .242(iltin or automatically e).2 F .242 +(xporting v)-.15 F .243(ariables in the shell')-.25 F 2.743(se)-.55 G +-.4(nv)-2.743 G .243(ironment to children is also not present).4 F .969 +(in the Bourne shell.)72 486 R .968(Bash pro)5.968 F .968 +(vides a much more po)-.15 F .968(werful en)-.25 F .968 +(vironment for both interacti)-.4 F 1.268 -.15(ve u)-.25 H .968 +(se and pro-).15 F(gramming.)72 498 Q F1 2.5(4. Bash-speci\214c)72 522 R +-.25(Fe)2.5 G(atur).25 E(es)-.18 E F0 .491(This section details a fe)97 +537.6 R 2.991(wo)-.25 G 2.991(ft)-2.991 G .491(he features which mak) +-2.991 F 2.991(eB)-.1 G .491(ash unique.)-2.991 F .492(Most of them pro) +5.491 F .492(vide impro)-.15 F -.15(ve)-.15 G(d).15 E(interacti)72 549.6 +Q 1.182 -.15(ve u)-.25 H .882(se, b).15 F .882(ut a fe)-.2 F 3.382(wp) +-.25 G .882(rogramming impro)-3.382 F -.15(ve)-.15 G .882 +(ments are present as well.).15 F .882(Full descriptions of these fea-) +5.882 F(tures can be found in the Bash documentation.)72 561.6 Q F1 2.5 +(4.1. Startup)72 585.6 R(Files)2.5 E F0 .161(Bash e)97 601.2 R -.15(xe) +-.15 G .161(cutes startup \214les dif).15 F .161 +(ferently than other shells.)-.25 F .162(The Bash beha)5.161 F .162 +(vior is a compromise between)-.2 F .29 +(the csh principle of startup \214les with \214x)72 613.2 R .29 +(ed names e)-.15 F -.15(xe)-.15 G .29 +(cuted for each shell and the sh \231minimalist\232 beha).15 F(vior)-.2 +E(.)-.55 E 2.955(An interacti)72 625.2 R 3.255 -.15(ve i)-.25 H 2.955 +(nstance of Bash started as a login shell reads and e).15 F -.15(xe)-.15 +G(cutes).15 E/F3 10/Times-Italic@0 SF(~/.bash_pr)5.456 E(o\214le)-.45 E +F0 2.956(\(the \214le)5.456 F .954(.bash_pro\214le in the user')72 637.2 +R 3.454(sh)-.55 G .953(ome directory\), if it e)-3.454 F 3.453 +(xists. An)-.15 F(interacti)3.453 E 1.253 -.15(ve n)-.25 H .953 +(on-login shell reads and e).15 F -.15(xe)-.15 G(cutes).15 E F3 +(~/.bashr)72 649.2 Q(c)-.37 E F0 5.641(.A)C(non-interacti)-2.5 E .942 +-.15(ve s)-.25 H .642(hell \(one be).15 F .642(gun to e)-.15 F -.15(xe) +-.15 G .642(cute a shell script, for e).15 F .642 +(xample\) reads no \214x)-.15 F .642(ed startup)-.15 F .342(\214le, b)72 +661.2 R .342(ut uses the v)-.2 F .342(alue of the v)-.25 F(ariable)-.25 +E F1($ENV)2.842 E F0 2.841(,i)C 2.841(fs)-2.841 G .341 +(et, as the name of a startup \214le.)-2.841 F .341 +(The ksh practice of read-)5.341 F(ing)72 673.2 Q F1($ENV)3.114 E F0 +.614(for e)3.114 F -.15(ve)-.25 G .614(ry shell, with the accompan).15 F +.615(ying dif)-.15 F .615(\214culty of de\214ning the proper v)-.25 F +.615(ariables and functions)-.25 F .721(for interacti)72 685.2 R 1.021 +-.15(ve a)-.25 H .721(nd non-interacti).15 F 1.021 -.15(ve s)-.25 H .721 +(hells or ha).15 F .721(ving the \214le read only for interacti)-.2 F +1.02 -.15(ve s)-.25 H .72(hells, w).15 F .72(as considered)-.1 F .158 +(too comple)72 697.2 R 2.658(x. Ease)-.15 F .158(of use w)2.658 F .158 +(on out here.)-.1 F(Interestingly)5.158 E 2.658(,t)-.65 G .158(he ne) +-2.658 F .159(xt release of ksh will change to reading)-.15 F F1($ENV) +2.659 E .32 LW 144 705.2 72 705.2 DL/F4 8/Times-Roman@0 SF .559 +(\207Bill Jo)72 717 R 1.599 -.52(y, A)-.08 H 2.559(nI).52 G .559 +(ntroduction to the C Shell,)-2.559 F/F5 8/Times-Italic@0 SF .558 +(UNIX User')2.558 F 2.558(sS)-.32 G .558(upplementary Documents)-2.558 F +F4 2.558(,U)C(ni)-2.558 E -.12(ve)-.2 G .558(rsity of California at).12 +F(Berk)72 727 Q(ele)-.08 E 1.04 -.52(y, 1)-.12 H(986.).52 E EP +%%Page: 4 4 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(-4-)282.17 48 Q(only for interacti)72 84 Q .3 +-.15(ve s)-.25 H(hells.).15 E/F1 10/Times-Bold@0 SF 2.5(4.2. New)72 108 +R(Builtin Commands)2.5 E F0 1.02(There are a fe)97 123.6 R 3.52(wb)-.25 +G 1.02(uiltins which are ne)-3.72 F 3.52(wo)-.25 G 3.52(rh)-3.52 G -2.25 +-.2(av e)-3.52 H 1.02(been e)3.72 F 1.02(xtended in Bash.)-.15 F(The) +6.02 E F1(enable)3.52 E F0 -.2(bu)3.52 G 1.02(iltin allo).2 F(ws)-.25 E +-.2(bu)72 135.6 S .824(iltin commands to be turned on and of).2 F 3.324 +(fa)-.25 G(rbitrarily)-3.324 E 5.824(.T)-.65 G 3.324(ou)-6.624 G .824 +(se the v)-3.324 F .824(ersion of)-.15 F/F2 10/Times-Italic@0 SF(ec) +3.324 E(ho)-.15 E F0 .825(found in a user')3.324 F 3.325(ss)-.55 G +(earch)-3.325 E .625(path rather than the Bash b)72 147.6 R(uiltin,)-.2 +E/F3 10/Courier@0 SF .625(enable -n echo)3.125 F F0(suf)3.125 E 3.125 +(\214ces. The)-.25 F F1(help)3.124 E F0 -.2(bu)3.124 G .624(iltin pro).2 +F .624(vides quick synopses)-.15 F .703(of the shell f)72 159.6 R .704 +(acilities without requiring access to a manual page.)-.1 F F1(Builtin) +5.704 E F0 .704(is similar to)3.204 F F1(command)3.204 E F0 .704 +(in that it)3.204 F .342(bypasses shell functions and directly e)72 +171.6 R -.15(xe)-.15 G .342(cutes b).15 F .342(uiltin commands.)-.2 F +.342(Access to a csh-style stack of directories)5.342 F .072(is pro)72 +183.6 R .073(vided via the)-.15 F F1(pushd)2.573 E F0(,)A F1(popd)2.573 +E F0 2.573(,a)C(nd)-2.573 E F1(dirs)2.573 E F0 -.2(bu)2.573 G(iltins.).2 +E F1(Pushd)5.073 E F0(and)2.573 E F1(popd)2.573 E F0 .073 +(insert and remo)2.573 F .373 -.15(ve d)-.15 H .073(irectories from the) +.15 F 2.858(stack, respecti)72 195.6 R -.15(ve)-.25 G(ly).15 E 5.358(,a) +-.65 G(nd)-5.358 E F1(dirs)5.358 E F0 2.858(lists the stack contents.) +5.358 F 2.858(On systems that allo)7.858 F 5.358<778c>-.25 G 2.857 +(ne-grained control of)-5.358 F 1.339(resources, the)72 207.6 R F1 +(ulimit)3.839 E F0 -.2(bu)3.839 G 1.339 +(iltin can be used to tune these settings.).2 F F1(Ulimit)6.34 E F0 +(allo)3.84 E 1.34(ws a user to control, among)-.25 F 1.086 +(other things, whether core dumps are to be generated, ho)72 219.6 R +3.586(wm)-.25 G 1.086(uch memory the shell or a child process is)-3.586 +F(allo)72 231.6 Q .496(wed to allocate, and ho)-.25 F 2.996(wl)-.25 G +(ar)-2.996 E .496(ge a \214le created by a child process can gro)-.18 F +4.296 -.65(w. T)-.25 H(he).65 E F1(suspend)2.996 E F0 .497(command will) +2.997 F .744(stop the shell process when job control is acti)72 243.6 R +-.15(ve)-.25 G 3.243(;m).15 G .743(ost other shells do not allo)-3.243 F +3.243(wt)-.25 G(hemselv)-3.243 E .743(es to be stopped)-.15 F(lik)72 +255.6 Q 2.717(et)-.1 G(hat.)-2.717 E F1 -.74(Ty)5.217 G(pe,).74 E F0 +.217(the Bash answer to)2.717 F F1(which)2.717 E F0(and)2.717 E F1 +(whence,)2.717 E F0(sho)2.717 E .218(ws what will happen when a w)-.25 F +.218(ord is typed as a)-.1 F(command:)72 267.6 Q F3 6($t)97 285.6 S +(ype export)-6 E(export is a shell builtin)97 297.6 Q 6($t)97 309.6 S +(ype -t export)-6 E(builtin)97 321.6 Q 6($t)97 333.6 S(ype bash)-6 E +(bash is /bin/bash)97 345.6 Q 6($t)97 357.6 S(ype cd)-6 E +(cd is a function)97 369.6 Q(cd \(\))97 381.6 Q({)97 393.6 Q +(builtin cd ${1+"$@"} && xtitle $HOST: $PWD)121 405.6 Q(})97 417.6 Q F0 +-1.11(Va)72 439.2 S .682(rious modes tell what a command w)1.11 F .681 +(ord is \(reserv)-.1 F .681(ed w)-.15 F .681(ord, alias, function, b)-.1 +F .681(uiltin, or \214le\) or which v)-.2 F(er)-.15 E(-)-.2 E 1.15 +(sion of a command will be e)72 451.2 R -.15(xe)-.15 G 1.15 +(cuted based on a user').15 F 3.65(ss)-.55 G 1.15(earch path.)-3.65 F +1.15(Some of this functionality has been)6.15 F +(adopted by POSIX.2 and folded into the)72 463.2 Q F1(command)2.5 E F0 +(utility)2.5 E(.)-.65 E F1 2.5(4.3. Editing)72 487.2 R(and Completion) +2.5 E F0 .682(One area in which Bash shines is command line editing.)97 +502.8 R .682(Bash uses the)5.682 F F2 -.37(re)3.182 G(adline).37 E F0 +.681(library to read and)3.181 F .942(edit lines when interacti)72 514.8 +R -.15(ve)-.25 G 5.942(.R).15 G .942(eadline is a po)-5.942 F .942 +(werful and \215e)-.25 F .942(xible input f)-.15 F .943 +(acility that a user can con\214gure to)-.1 F(indi)72 526.8 Q .732 +(vidual tastes.)-.25 F .732(It allo)5.732 F .732(ws lines to be edited \ +using either emacs or vi commands, where those commands)-.25 F .2 +(are appropriate.)72 538.8 R .2 +(The full capability of emacs is not present \255 there is no w)5.2 F .2 +(ay to e)-.1 F -.15(xe)-.15 G .2(cute a named command).15 F 1.15 +(with M-x, for instance \255 b)72 550.8 R 1.15(ut the e)-.2 F 1.149 +(xisting commands are more than adequate.)-.15 F 1.149 +(The vi mode is compliant)6.149 F +(with the command line editing standardized by POSIX.2.)72 562.8 Q 1.69 +(Readline is fully customizable.)97 578.4 R 1.691 +(In addition to the basic commands and k)6.69 F 1.991 -.15(ey b)-.1 H +1.691(indings, the library).15 F(allo)72 590.4 Q .028 +(ws users to de\214ne additional k)-.25 F .327 -.15(ey b)-.1 H .027 +(indings using a startup \214le.).15 F(The)5.027 E F2(inputr)2.527 E(c) +-.37 E F0 .027(\214le, which def)2.527 F .027(aults to the \214le)-.1 F +F2(~/.inputr)72 602.4 Q(c)-.37 E F0 3.002(,i)C 3.002(sr)-3.002 G .503(e\ +ad each time readline initializes, permitting users to maintain a consi\ +stent interf)-3.002 F .503(ace across a)-.1 F .893(set of programs.)72 +614.4 R .893(Readline includes an e)5.893 F .893(xtensible interf)-.15 F +.892(ace, so each program using the library can add its)-.1 F -.25(ow)72 +626.4 S 3.56(nb).25 G 1.06(indable commands and program-speci\214c k) +-3.56 F 1.361 -.15(ey b)-.1 H 3.561(indings. Bash).15 F 1.061 +(uses this f)3.561 F 1.061(acility to add bindings that)-.1 F +(perform history e)72 638.4 Q(xpansion or shell w)-.15 E(ord e)-.1 E +(xpansions on the current input line.)-.15 E .707 +(Readline interprets a number of v)97 654 R .706 +(ariables which further tune its beha)-.25 F(vior)-.2 E 5.706(.V)-.55 G +.706(ariables e)-6.816 F .706(xist to control)-.15 F .157 +(whether or not eight-bit characters are directly read as input or con) +72 666 R -.15(ve)-.4 G .158(rted to meta-pre\214x).15 F .158(ed k)-.15 F +.458 -.15(ey s)-.1 H .158(equences \(a).15 F(meta-pre\214x)72 678 Q .082 +(ed k)-.15 F .382 -.15(ey s)-.1 H .081(equence consists of the characte\ +r with the eighth bit zeroed, preceded by the).15 F F2(meta-pr)2.581 E +(e\214x)-.37 E F0(character)72 690 Q 3.233(,u)-.4 G .733 +(sually escape, which selects an alternate k)-3.233 F -.15(ey)-.1 G .734 +(map\), to decide whether to output characters with).15 F .624 +(the eighth bit set directly or as a meta-pre\214x)72 702 R .624(ed k) +-.15 F .924 -.15(ey s)-.1 H .623 +(equence, whether or not to wrap to a ne).15 F 3.123(ws)-.25 G .623 +(creen line)-3.123 F 1.196 +(when a line being edited is longer than the screen width, the k)72 714 +R -.15(ey)-.1 G 1.196(map to which subsequent k).15 F 1.496 -.15(ey b) +-.1 H(indings).15 E .531(should apply)72 726 R 3.031(,o)-.65 G 3.031(re) +-3.031 G -.15(ve)-3.281 G 3.031(nw).15 G .531 +(hat happens when readline w)-3.031 F .531(ants to ring the terminal') +-.1 F 3.03(sb)-.55 G 3.03(ell. All)-3.03 F .53(of these v)3.03 F +(ariables)-.25 E EP +%%Page: 5 5 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(-5-)282.17 48 Q +(can be set in the inputrc \214le.)72 84 Q .284 +(The startup \214le understands a set of C preprocessor)97 99.6 R(-lik) +-.2 E 2.785(ec)-.1 G .285(onditional constructs which allo)-2.785 F +2.785(wv)-.25 G(ariables)-3.035 E .12(or k)72 111.6 R .42 -.15(ey b)-.1 +H .119(indings to be assigned based on the application using readline, \ +the terminal currently being used, or).15 F .338(the editing mode.)72 +123.6 R .338(Users can add program-speci\214c bindings to mak)5.338 F +2.838(et)-.1 G .338(heir li)-2.838 F -.15(ve)-.25 G 2.838(se).15 G 2.838 +(asier: I)-2.838 F(ha)2.838 E .639 -.15(ve b)-.2 H .339(indings that).15 +F(let me edit the v)72 135.6 Q(alue of)-.25 E/F1 10/Times-Bold@0 SF($P) +2.5 E -.95(AT)-.74 G(H).95 E F0(and double-quote the current or pre)2.5 +E(vious w)-.25 E(ord:)-.1 E/F2 10/Courier@0 SF 6(#M)97 153.6 S +(acros that are convenient for shell interaction)-6 E($if Bash)97 165.6 +Q 6(#e)97 177.6 S(dit the path)-6 E +("\\C-xp": "PATH=${PATH}\\e\\C-e\\C-a\\ef\\C-f")97 189.6 Q 6(#p)97 201.6 +S(repare to type a quoted word -- insert open and close double)-6 E 6 +(#q)97 213.6 S(uotes and move to just after the open quote)-6 E +("\\C-x\\"": "\\"\\"\\C-b")97 225.6 Q 6(#Q)97 237.6 S +(uote the current or previous word)-6 E("\\C-xq": "\\eb\\"\\ef\\"")97 +249.6 Q($endif)97 261.6 Q F0 .322(There is a readline command to re-rea\ +d the \214le, so users can edit the \214le, change some bindings, and b\ +e)72 283.2 R(gin)-.15 E(to use them almost immediately)72 295.2 Q(.)-.65 +E .851(Bash implements the)97 310.8 R F1(bind)3.351 E F0 -.2(bu)3.351 G +.851(iltin for more dyamic control of readline than the startup \214le \ +permits.).2 F F1(Bind)72 322.8 Q F0 .25(is used in se)2.75 F -.15(ve) +-.25 G .25(ral w).15 F 2.75(ays. In)-.1 F/F3 10/Times-Italic@0 SF(list) +2.75 E F0 .25(mode, it can display the current k)2.75 F .55 -.15(ey b) +-.1 H .25(indings, list all the readline edit-).15 F .149(ing directi)72 +334.8 R -.15(ve)-.25 G 2.649(sa).15 G -.25(va)-2.849 G .149 +(ilable for binding, list which k).25 F -.15(ey)-.1 G 2.649(si).15 G +-1.9 -.4(nv o)-2.649 H .349 -.1(ke a g).4 H -2.15 -.25(iv e).1 H 2.65 +(nd).25 G(irecti)-2.65 E -.15(ve)-.25 G 2.65(,o).15 G 2.65(ro)-2.65 G +.15(utput the current set of k)-2.65 F -.15(ey)-.1 G .042(bindings in a\ + format that can be incorporated directly into an inputrc \214le.)72 +346.8 R(In)5.041 E F3(batc)2.541 E(h)-.15 E F0 .041 +(mode, it reads a series of)2.541 F -.1(ke)72 358.8 S 2.858(yb)-.05 G +.359(indings directly from a \214le and passes them to readline.)-2.858 +F .359(In its most common usage,)5.359 F F1(bind)2.859 E F0(tak)2.859 E +.359(es a sin-)-.1 F 1.117(gle string and passes it directly to readlin\ +e, which interprets the line as if it had just been read from the)72 +370.8 R(inputrc \214le.)72 382.8 Q(Both k)5 E .3 -.15(ey b)-.1 H +(indings and v).15 E(ariable assignments may appear in the string gi) +-.25 E -.15(ve)-.25 G 2.5(nt).15 G(o)-2.5 E F1(bind)2.5 E F0(.)A .53 +(The readline library also pro)97 398.4 R .53(vides an interf)-.15 F .53 +(ace for)-.1 F F3(wor)3.03 E 3.03(dc)-.37 G(ompletion)-3.03 E F0 5.53 +(.W)C .53(hen the)-5.53 F F3(completion)3.03 E F0(character)3.03 E 1.261 +(\(usually T)72 410.4 R 1.261(AB\) is typed, readline looks at the w) +-.93 F 1.26(ord currently being entered and computes the set of \214le-) +-.1 F .523(names of which the current w)72 422.4 R .523(ord is a v)-.1 F +.523(alid pre\214x.)-.25 F .524 +(If there is only one possible completion, the rest of the)5.523 F .358 +(characters are inserted directly)72 434.4 R 2.858(,o)-.65 G .358(therw\ +ise the common pre\214x of the set of \214lenames is added to the curre\ +nt)-2.858 F -.1(wo)72 446.4 S 3.199(rd. A).1 F .699(second T)3.199 F +.699(AB character entered immediately after a non-unique completion cau\ +ses readline to list)-.93 F 1.814 +(the possible completions; there is an option to ha)72 458.4 R 2.113 +-.15(ve t)-.2 H 1.813(he list displayed immediately).15 F 6.813(.R)-.65 +G 1.813(eadline pro)-6.813 F(vides)-.15 E .482 +(hooks so that applications can pro)72 470.4 R .482 +(vide speci\214c types of completion before the def)-.15 F .483 +(ault \214lename completion)-.1 F .132(is attempted.)72 482.4 R .132 +(This is quite \215e)5.132 F .132 +(xible, though it is not completely user)-.15 F 2.632 +(-programmable. Bash,)-.2 F .132(for e)2.632 F .132(xample, can)-.15 F +.37(complete \214lenames, command names \(including aliases, b)72 494.4 +R .37(uiltins, shell reserv)-.2 F .37(ed w)-.15 F .37 +(ords, shell functions, and)-.1 F -.15(exe)72 506.4 S .424 +(cutables found in the \214le system\), shell v).15 F .424 +(ariables, usernames, and hostnames.)-.25 F .423 +(It uses a set of heuristics)5.424 F(that, while not perfect, is genera\ +lly quite good at determining what type of completion to attempt.)72 +518.4 Q F1 2.5(4.4. History)72 542.4 R F0 .144 +(Access to the list of commands pre)97 558 R .144(viously entered \(the) +-.25 F F3 .144(command history)2.644 F F0 2.644(\)i)C 2.644(sp)-2.644 G +(ro)-2.644 E .144(vided jointly by Bash)-.15 F .078 +(and the readline library)72 570 R 5.077(.B)-.65 G .077(ash pro)-5.077 F +.077(vides v)-.15 F .077(ariables \()-.25 F F1($HISTFILE)A F0(,)A F1 +($HISTSIZE)2.577 E F0 2.577(,a)C(nd)-2.577 E F1($HISTCONTR)2.577 E(OL) +-.3 E F0 2.577(\)a)C(nd)-2.577 E(the)72 582 Q F1(history)2.89 E F0(and) +2.89 E F1(fc)2.89 E F0 -.2(bu)2.89 G .39 +(iltins to manipulate the history list.).2 F .391(The v)5.391 F .391 +(alue of)-.25 F F1($HISTFILE)2.891 E F0 .391(specifes the \214le where) +2.891 F .49(Bash writes the command history on e)72 594 R .489 +(xit and reads it on startup.)-.15 F F1($HISTSIZE)5.489 E F0 .489 +(is used to limit the number)2.989 F .642(of commands sa)72 606 R -.15 +(ve)-.2 G 3.142(di).15 G 3.142(nt)-3.142 G .642(he history)-3.142 F(.) +-.65 E F1($HISTCONTR)5.642 E(OL)-.3 E F0(pro)3.142 E .642 +(vides a crude form of control o)-.15 F -.15(ve)-.15 G 3.142(rw).15 G +.642(hich com-)-3.142 F .025(mands are sa)72 618 R -.15(ve)-.2 G 2.525 +(do).15 G 2.525(nt)-2.525 G .025(he history list: a v)-2.525 F .025 +(alue of)-.25 F F3(ignor)2.525 E(espace)-.37 E F0 .025(means to not sa) +2.525 F .324 -.15(ve c)-.2 H .024(ommands which be).15 F .024 +(gin with a)-.15 F .927(space; a v)72 630 R .927(alue of)-.25 F F3 +(ignor)3.427 E(edups)-.37 E F0 .927(means to not sa)3.427 F 1.228 -.15 +(ve c)-.2 H .928(ommands identical to the last command sa).15 F -.15(ve) +-.2 G(d.).15 E F1($HIST)5.928 E(-)-.92 E(CONTR)72 642 Q(OL)-.3 E F0 -.1 +(wa)3.778 G 3.778(sn).1 G(amed)-3.778 E F1($history_contr)3.778 E(ol) +-.18 E F0 1.278(in earlier v)3.778 F 1.278 +(ersions of Bash; the old name is still accepted for)-.15 F(backw)72 654 +Q .575(ards compatibility)-.1 F 5.575(.T)-.65 G(he)-5.575 E F1(history) +3.075 E F0 .575 +(command can read or write \214les containing the history list and dis-) +3.075 F .167(play the current list contents.)72 666 R(The)5.167 E F1(fc) +2.667 E F0 -.2(bu)2.667 G .167(iltin, adopted from POSIX.2 and the K).2 +F .167(orn Shell, allo)-.35 F .167(ws display and)-.25 F(re-e)72 678 Q +-.15(xe)-.15 G .58 +(cution, with optional editing, of commands from the history list.).15 F +.58(The readline library of)5.58 F .58(fers a set of)-.25 F 1.255(comma\ +nds to search the history list for a portion of the current input line \ +or a string typed by the user)72 690 R(.)-.55 E(Finally)72 702 Q 2.535 +(,t)-.65 G(he)-2.535 E F3(history)2.535 E F0(library)2.535 E 2.535(,g) +-.65 G .036(enerally incorporated directly into the readline library) +-2.535 F 2.536(,i)-.65 G .036(mplements a f)-2.536 F .036(acility for) +-.1 F 1.023(history recall, e)72 714 R 1.022(xpansion, and re-e)-.15 F +-.15(xe)-.15 G 1.022(cution of pre).15 F 1.022(vious commands v)-.25 F +1.022(ery similar to csh \(\231bang history\232, so)-.15 F +(called because the e)72 726 Q +(xclamation point introduces a history substitution\):)-.15 E EP +%%Page: 6 6 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(-6-)282.17 48 Q/F1 10/Courier@0 SF 6($e)97 84 S +(cho a b c d e)-6 E 6(abcde)97 96 S 6($!)97 108 S 6(!fghi)-6 G +(echo a b c d e f g h i)97 120 Q 6(abcdefghi)97 132 S 6($!)97 144 S(-2) +-6 E(echo a b c d e)97 156 Q 6(abcde)97 168 S 6($e)97 180 S(cho !-2:1-4) +-6 E(echo a b c d)97 192 Q 6(abcd)97 204 S F0 1.456 +(The command history is only sa)72 225.6 R -.15(ve)-.2 G 3.957(dw).15 G +1.457(hen the shell is interacti)-3.957 F -.15(ve)-.25 G 3.957(,s).15 G +3.957(oi)-3.957 G 3.957(ti)-3.957 G 3.957(sn)-3.957 G 1.457(ot a)-3.957 +F -.25(va)-.2 G 1.457(ilable for use by shell).25 F(scripts.)72 237.6 Q +/F2 10/Times-Bold@0 SF 2.5(4.5. New)72 261.6 R(Shell V)2.5 E(ariables) +-.92 E F0 .59(There are a number of con)97 277.2 R -.15(ve)-.4 G .589 +(nience v).15 F .589(ariables that Bash interprets to mak)-.25 F 3.089 +(el)-.1 G .589(ife easier)-3.089 F 5.589(.T)-.55 G .589(hese include) +-5.589 F F2(FIGNORE)72 289.2 Q F0 3.973(,w)C 1.473 +(hich is a set of \214lename suf)-3.973 F<8c78>-.25 E 1.474 +(es identifying \214les to e)-.15 F 1.474 +(xclude when completing \214lenames;)-.15 F F2(HOSTTYPE)72 301.2 Q F0 +2.932(,w)C .432 +(hich is automatically set to a string describing the type of hardw) +-2.932 F .431(are on which Bash is cur)-.1 F(-)-.2 E .335(rently e)72 +313.2 R -.15(xe)-.15 G(cuting;).15 E F2(command_oriented_history)2.835 E +F0 2.835(,w)C .335(hich directs Bash to sa)-2.835 F .635 -.15(ve a)-.2 H +.336(ll lines of a multiple-line com-).15 F 1.071(mand such as a)72 +325.2 R/F3 10/Times-Italic@0 SF(while)3.571 E F0(or)3.571 E F3(for)3.571 +E F0 1.071(loop in a single history entry)3.571 F 3.57(,a)-.65 G(llo) +-3.57 E 1.07(wing easy re-editing; and)-.25 F F2(IGNOREEOF)3.57 E F0(,)A +.747(whose v)72 337.2 R .747(alue indicates the number of consecuti)-.25 +F 1.047 -.15(ve E)-.25 H .747(OF characters that an interacti).15 F +1.048 -.15(ve s)-.25 H .748(hell will read before).15 F -.15(ex)72 349.2 +S 1.432(iting \255 an easy w).15 F 1.432(ay to k)-.1 F 1.432 +(eep yourself from being logged out accidentally)-.1 F 6.432(.T)-.65 G +(he)-6.432 E F2(auto_r)3.932 E(esume)-.18 E F0 -.25(va)3.932 G(riable) +.25 E .571(alters the w)72 361.2 R .571 +(ay the shell treats simple command names: if job control is acti)-.1 F +-.15(ve)-.25 G 3.071(,a).15 G .571(nd this v)-3.071 F .571 +(ariable is set, sin-)-.25 F(gle-w)72 373.2 Q .239(ord simple commands \ +without redirections cause the shell to \214rst look for and restart a \ +suspended job)-.1 F(with that name before starting a ne)72 385.2 Q 2.5 +(wp)-.25 G(rocess.)-2.5 E F2 2.5(4.6. Brace)72 409.2 R(Expansion)2.5 E +F0 .653(Since sh of)97 424.8 R .653(fers no con)-.25 F -.15(ve)-.4 G +.653(nient w).15 F .653 +(ay to generate arbitrary strings that share a common pre\214x or suf) +-.1 F<8c78>-.25 E 2.124(\(\214lename e)72 436.8 R 2.124 +(xpansion requires that the \214lenames e)-.15 F 2.123 +(xist\), Bash implements)-.15 F F3(br)4.623 E 2.123(ace e)-.15 F +(xpansion)-.2 E F0 4.623(,ac)C(apability)-4.623 E(pick)72 448.8 Q .773 +(ed up from csh.)-.1 F .774(Brace e)5.773 F .774 +(xpansion is similar to \214lename e)-.15 F .774(xpansion, b)-.15 F .774 +(ut the strings generated need not)-.2 F 1.211(correspond to e)72 460.8 +R 1.211(xisting \214les.)-.15 F 3.711(Ab)6.211 G 1.211(race e)-3.711 F +1.211(xpression consists of an optional)-.15 F F3(pr)3.71 E(eamble)-.37 +E F0 3.71(,f)C(ollo)-3.71 E 1.21(wed by a pair of)-.25 F 2.938 +(braces enclosing a series of comma-separated strings, and an optional) +72 472.8 R F3(postamble)5.438 E F0 7.938(.T)C 2.938(he preamble is) +-7.938 F(prepended to each string within the braces, and the postamble \ +is then appended to each resulting string:)72 484.8 Q F1 6($e)97 502.8 S +(cho a{d,c,b}e)-6 E(ade ace abe)97 514.8 Q F0 .306(As this e)72 536.4 R +.306(xample demonstrates, the results of brace e)-.15 F .305 +(xpansion are not sorted, as the)-.15 F 2.805(ya)-.15 G .305 +(re by \214lename e)-2.805 F(xpan-)-.15 E(sion.)72 548.4 Q F2 2.5 +(4.7. Pr)72 572.4 R(ocess Substitution)-.18 E F0 .457 +(On systems that can support it, Bash pro)97 588 R .457(vides a f)-.15 F +.457(acility kno)-.1 F .458(wn as)-.25 F F3(pr)2.958 E .458 +(ocess substitution)-.45 F F0 5.458(.P)C .458(rocess sub-)-5.458 F .347 +(stitution is similar to command substitution in that its speci\214cati\ +on includes a command to e)72 600 R -.15(xe)-.15 G .346(cute, b).15 F +.346(ut the)-.2 F .181(shell does not collect the command')72 612 R +2.681(so)-.55 G .181(utput and insert it into the command line.)-2.681 F +(Rather)5.181 E 2.681(,B)-.4 G .182(ash opens a pipe)-2.681 F 1.861 +(to the command, which is run in the background.)72 624 R 1.861 +(The shell uses named pipes \(FIFOs\) or the)6.861 F F3(/de)4.361 E +(v/fd)-.15 E F0 .961(method of naming open \214les to e)72 636 R .962(x\ +pand the process substitution to a \214lename which connects to the pip\ +e)-.15 F .104(when opened.)72 648 R .103 +(This \214lename becomes the result of the e)5.104 F 2.603 +(xpansion. Process)-.15 F .103(substitution can be used to com-)2.603 F +(pare the outputs of tw)72 660 Q 2.5(od)-.1 G(if)-2.5 E(ferent v)-.25 E +(ersions of an application as part of a re)-.15 E(gression test:)-.15 E +F1 6($c)97 678 S(mp <\(old_prog\) <\(new_prog\))-6 E EP +%%Page: 7 7 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(-7-)282.17 48 Q/F1 10/Times-Bold@0 SF 2.5 +(4.8. Pr)72 84 R(ompt Customization)-.18 E F0 2.229 +(One of the more popular interacti)97 99.6 R 2.529 -.15(ve f)-.25 H +2.229(eatures that Bash pro).15 F 2.23 +(vides is the ability to customize the)-.15 F 3.234(prompt. Both)72 +111.6 R F1($PS1)3.234 E F0(and)3.234 E F1($PS2,)3.234 E F0 .734 +(the primary and secondary prompts, are e)3.234 F .733 +(xpanded before being displayed.)-.15 F -.15(Pa)72 123.6 S .804 +(rameter and v).15 F .804(ariable e)-.25 F .805 +(xpansion is performed when the prompt string is e)-.15 F .805 +(xpanded, so an)-.15 F 3.305(ys)-.15 G .805(hell v)-3.305 F(ariable)-.25 +E .729(can be put into the prompt \(e.g.,)72 135.6 R F1($SHL)3.228 E(VL) +-.92 E F0 3.228(,w)C .728(hich indicates ho)-3.228 F 3.228(wd)-.25 G +.728(eeply the current shell is nested\).)-3.228 F(Bash)5.728 E 1.895(s\ +pecially interprets characters in the prompt string preceded by a backs\ +lash.)72 147.6 R 1.895(Some of these backslash)6.895 F .874 +(escapes are replaced with the current time, the date, the current w)72 +159.6 R .874(orking directory)-.1 F 3.373(,t)-.65 G .873 +(he username, and the)-3.373 F .78 +(command number or history number of the command being entered.)72 171.6 +R .781(There is e)5.781 F -.15(ve)-.25 G 3.281(nab).15 G .781 +(ackslash escape to)-3.281 F .007 +(cause the shell to change its prompt when running as root after an)72 +183.6 R/F2 10/Times-Italic@0 SF(su)2.507 E F0 5.007(.B)C .007 +(efore printing each primary prompt,)-5.007 F .305(Bash e)72 195.6 R +.305(xpands the v)-.15 F(ariable)-.25 E F1($PR)2.805 E(OMPT_COMMAND)-.3 +E F0 .305(and, if it has a v)2.805 F .306(alue, e)-.25 F -.15(xe)-.15 G +.306(cutes the e).15 F .306(xpanded v)-.15 F .306(alue as)-.25 F 3.735 +(ac)72 207.6 S 1.235(ommand, allo)-3.735 F 1.234 +(wing additional prompt customization.)-.25 F -.15(Fo)6.234 G 3.734(re) +.15 G 1.234(xample, this assignment causes the current)-3.884 F(user)72 +219.6 Q 2.917(,t)-.4 G .417 +(he current host, the time, the last component of the current w)-2.917 F +.417(orking directory)-.1 F 2.917(,t)-.65 G .418(he le)-2.917 F -.15(ve) +-.25 G 2.918(lo).15 G 2.918(fs)-2.918 G .418(hell nest-)-2.918 F(ing, a\ +nd the history number of the current command to be embedded into the pr\ +imary prompt:)72 231.6 Q/F3 10/Courier@0 SF 6($P)97 249.6 S +(S1='\\u@\\h [\\t] \\W\($SHLVL:\\!\)\\$ ')-6 E +(chet@odin [21:03:44] documentation\(2:636\)$ cd ..)97 261.6 Q +(chet@odin [21:03:54] src\(2:637\)$)97 273.6 Q F0 .146(The string being\ + assigned is surrounded by single quotes so that if it is e)72 295.2 R +.146(xported, the v)-.15 F .146(alue of)-.25 F F1($SHL)2.646 E(VL)-.92 E +F0(will)2.646 E(be updated by a child shell:)72 307.2 Q F3 +(chet@odin [21:17:35] src\(2:638\)$ export PS1)97 325.2 Q +(chet@odin [21:17:40] src\(2:639\)$ bash)97 337.2 Q +(chet@odin [21:17:46] src\(3:696\)$)97 349.2 Q F0 +(The \\$ escape is displayed as \231)72 370.8 Q F1($)A F0 2.5<9a77>C +(hen running as a normal user)-2.5 E 2.5(,b)-.4 G(ut as \231)-2.7 E F1 +(#)A F0 2.5<9a77>C(hen running as root.)-2.5 E F1 2.5(4.9. File)72 394.8 +R(System V)2.5 E(iews)-.37 E F0 .029(Since Berk)97 410.4 R(ele)-.1 E +2.529(yi)-.15 G .029 +(ntroduced symbolic links in 4.2 BSD, one of their most anno)-2.529 F +.03(ying properties has been)-.1 F .764(the \231w)72 422.4 R .764 +(arping\232 to a completely dif)-.1 F .764 +(ferent area of the \214le system when using)-.25 F F1(cd)3.263 E F0 +3.263(,a)C .763(nd the resultant non-intu-)-3.263 F(iti)72 434.4 Q .704 +-.15(ve b)-.25 H(eha).15 E .405(vior of \231)-.2 F F1 .405(cd ..)B F0 +2.905(\232. The)B/F4 9/Times-Roman@0 SF(UNIX)2.905 E F0 -.1(ke)2.905 G +.405(rnel treats symbolic links).1 F F2(physically)2.905 E F0 5.405(.W)C +.405(hen the k)-5.405 F .405(ernel is translating)-.1 F 3.223(ap)72 +446.4 S .723(athname in which one component is a symbolic link, it repl\ +aces all or part of the pathname while pro-)-3.223 F .668 +(cessing the link.)72 458.4 R .668 +(If the contents of the symbolic link be)5.668 F .669 +(gin with a slash, the k)-.15 F .669(ernel replaces the pathname)-.1 F +.219(entirely; if not, the link contents replace the current component.) +72 470.4 R .219(In either case, the symbolic link is visible.)5.219 F +.058(If the link v)72 482.4 R .058(alue is an absolute pathname, the us\ +er \214nds himself in a completely dif)-.25 F .059 +(ferent part of the \214le sys-)-.25 F(tem.)72 494.4 Q .704(Bash pro)97 +510 R .704(vides a)-.15 F F2(lo)3.203 E(gical)-.1 E F0(vie)3.203 E 3.203 +(wo)-.25 G 3.203(ft)-3.203 G .703(he \214le system.)-3.203 F .703 +(In this def)5.703 F .703(ault mode, command and \214lename com-)-.1 F +.522(pletion and b)72 522 R .522(uiltin commands such as)-.2 F F1(cd) +3.022 E F0(and)3.022 E F1(pushd)3.022 E F0 .522 +(which change the current w)3.022 F .522(orking directory transpar)-.1 F +(-)-.2 E .127(ently follo)72 534 R 2.627(ws)-.25 G .127 +(ymbolic links as if the)-2.627 F 2.627(yw)-.15 G .127(ere directories.) +-2.627 F(The)5.126 E F1($PWD)2.626 E F0 -.25(va)2.626 G .126 +(riable, which holds the shell').25 F 2.626(si)-.55 G .126(dea of)-2.626 +F .366(the current w)72 546 R .366(orking directory)-.1 F 2.866(,d)-.65 +G .367 +(epends on the path used to reach the directory rather than its ph) +-2.866 F .367(ysical loca-)-.05 F +(tion in the local \214le system hierarch)72 558 Q 3.8 -.65(y. F)-.05 H +(or e).5 E(xample:)-.15 E F3 6($c)97 576 S 6(d/)-6 G(usr/local/bin)-6 E +6($e)97 588 S(cho $PWD)-6 E(/usr/local/bin)97 600 Q 6($p)97 612 S(wd)-6 +E(/usr/local/bin)97 624 Q 6($/)97 636 S(bin/pwd)-6 E +(/net/share/sun4/local/bin)97 648 Q 6($c)97 660 S 6(d.)-6 G(.)-6 E 6($p) +97 672 S(wd)-6 E(/usr/local)97 684 Q 6($/)97 696 S(bin/pwd)-6 E +(/net/share/sun4/local)97 708 Q 6($c)97 720 S 6(d.)-6 G(.)-6 E EP +%%Page: 8 8 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(-8-)282.17 48 Q/F1 10/Courier@0 SF 6($p)97 84 S +(wd)-6 E(/usr)97 96 Q 6($/)97 108 S(bin/pwd)-6 E(/usr)97 120 Q F0 .3(On\ +e problem with this, of course, arises when programs that do not unders\ +tand the shell')72 141.6 R 2.8(sl)-.55 G .3(ogical notion of)-2.8 F .217 +(the \214le system interpret \231..)72 153.6 R 2.718<9a64>-.7 G(if) +-2.718 E(ferently)-.25 E 5.218(.T)-.65 G .218 +(his generally happens when Bash completes \214lenames containing)-5.218 +F(\231..)72 165.6 Q 3.384<9a61>-.7 G .884 +(ccording to a logical hierarch)-3.384 F 3.384(yw)-.05 G .884 +(hich does not correspond to their ph)-3.384 F .883(ysical location.) +-.05 F -.15(Fo)5.883 G 3.383(ru).15 G .883(sers who)-3.383 F +(\214nd this troublesome, a corresponding)72 177.6 Q/F2 10 +/Times-Italic@0 SF(physical)2.5 E F0(vie)2.5 E 2.5(wo)-.25 G 2.5(ft)-2.5 +G(he \214le system is a)-2.5 E -.25(va)-.2 G(ilable:).25 E F1 6($c)97 +195.6 S 6(d/)-6 G(usr/local/bin)-6 E 6($p)97 207.6 S(wd)-6 E +(/usr/local/bin)97 219.6 Q 6($s)97 231.6 S(et -o physical)-6 E 6($p)97 +243.6 S(wd)-6 E(/net/share/sun4/local/bin)97 255.6 Q/F3 10/Times-Bold@0 +SF 2.5(4.10. Inter)72 285.6 R(nationalization)-.15 E F0 .145 +(One of the most signi\214cant impro)97 301.2 R -.15(ve)-.15 G .145 +(ments in v).15 F .145(ersion 1.13 of Bash w)-.15 F .145 +(as the change to \231eight-bit clean-)-.1 F 2.933(liness\232. Pre)72 +313.2 R .433(vious v)-.25 F .432 +(ersions used the eighth bit of characters to mark whether or not the) +-.15 F 2.932(yw)-.15 G .432(ere quoted when)-2.932 F 1.495(performing w) +72 325.2 R 1.495(ord e)-.1 F 3.995(xpansions. While)-.15 F 1.495 +(this did not af)3.995 F 1.496 +(fect the majority of users, most of whom used only)-.25 F(se)72 337.2 Q +-.15(ve)-.25 G 1.236(n-bit ASCII characters, some found it con\214ning.) +.15 F(Be)6.236 E 1.236(ginning with v)-.15 F 1.236 +(ersion 1.13, Bash implemented a)-.15 F(dif)72 349.2 Q .02(ferent quoti\ +ng mechanism that did not alter the eighth bit of characters.)-.25 F +.021(This allo)5.021 F .021(wed Bash to manipulate)-.25 F .427 +(\214les with \231odd\232 characters in their names, b)72 361.2 R .427 +(ut did nothing to help users enter those names, so v)-.2 F .426 +(ersion 1.13)-.15 F 1.458 +(introduced changes to readline that made it eight-bit clean as well.)72 +373.2 R 1.458(Options e)6.458 F 1.458(xist that force readline to)-.15 F +.744(attach no special signi\214cance to characters with the eighth bit\ + set \(the def)72 385.2 R .744(ault beha)-.1 F .744(vior is to con)-.2 F +-.15(ve)-.4 G .744(rt these).15 F .641(characters to meta-pre\214x)72 +397.2 R .641(ed k)-.15 F .941 -.15(ey s)-.1 H .642 +(equences\) and to output these characters without con).15 F -.15(ve)-.4 +G .642(rsion to meta-pre-).15 F<8c78>72 409.2 Q .008(ed sequences.)-.15 +F .007(These changes, along with the e)5.007 F .007(xpansion of k)-.15 F +-.15(ey)-.1 G .007(maps to a full eight bits, enable readline to).15 F +-.1(wo)72 421.2 S(rk with most of the ISO-8859 f).1 E +(amily of character sets, used by man)-.1 E 2.5(yE)-.15 G +(uropean countries.)-2.5 E F3 2.5(4.11. POSIX)72 445.2 R(Mode)2.5 E F0 +.584(Although Bash is intended to be POSIX.2 conformant, there are area\ +s in which the def)97 460.8 R .584(ault beha)-.1 F(vior)-.2 E .463 +(is not compatible with the standard.)72 472.8 R -.15(Fo)5.463 G 2.962 +(ru).15 G .462(sers who wish to operate in a strict POSIX.2 en)-2.962 F +.462(vironment, Bash)-.4 F .505(implements a)72 484.8 R F2 .505 +(POSIX mode)3.005 F F0 5.505(.W)C .505(hen this mode is acti)-5.505 F +-.15(ve)-.25 G 3.005(,B).15 G .505(ash modi\214es its def)-3.005 F .505 +(ault operation where it dif)-.1 F(fers)-.25 E .267 +(from POSIX.2 to match the standard.)72 496.8 R .266 +(POSIX mode is entered when Bash is started with the)5.267 F F3(-posix) +2.766 E F0(option.)2.766 E .149(This feature is also a)72 508.8 R -.25 +(va)-.2 G .149(ilable as an option to the).25 F F3(set)2.649 E F0 -.2 +(bu)2.649 G(iltin,).2 E F3 .149(set -o posix)2.649 F F0 5.149(.F)C .149 +(or compatibility with other GNU)-5.299 F(softw)72 520.8 Q 4.02(are tha\ +t attempts to be POSIX.2 compliant, Bash also enters POSIX mode if the \ +v)-.1 F(ariable)-.25 E F3($POSIXL)72 532.8 Q(Y_CORRECT)-.92 E F0 5.824 +(is set when Bash is started or assigned a v)8.324 F 5.825 +(alue during e)-.25 F -.15(xe)-.15 G(cution.).15 E F3($POSIX_PED)72 +544.8 Q(ANTIC)-.35 E F0 .27 +(is accepted as well, to be compatible with some older GNU utilities.) +2.77 F .27(When Bash is)5.27 F .506(started in POSIX mode, for e)72 +556.8 R .506(xample, it sources the \214le named by the v)-.15 F .507 +(alue of)-.25 F F3($ENV)3.007 E F0 .507(rather than the \231nor)3.007 F +(-)-.2 E(mal\232 startup \214les, and does not allo)72 568.8 Q 2.5(wr) +-.25 G(eserv)-2.5 E(ed w)-.15 E(ords to be aliased.)-.1 E F3 2.5(5. New) +72 592.8 R -.25(Fe)2.5 G(atur).25 E(es and Futur)-.18 E 2.5(eP)-.18 G +(lans)-2.5 E F0 1.632(There are se)97 608.4 R -.15(ve)-.25 G 1.632 +(ral features introduced in the current v).15 F 1.631(ersion of Bash, v) +-.15 F 1.631(ersion 1.14, and a number)-.15 F .241 +(under consideration for future releases.)72 620.4 R .242 +(This section will brie\215y detail the ne)5.242 F 2.742(wf)-.25 G .242 +(eatures in v)-2.742 F .242(ersion 1.14 and)-.15 F(describe se)72 632.4 +Q -.15(ve)-.25 G(ral features that may appear in later v).15 E(ersions.) +-.15 E F3 2.5(5.1. New)72 656.4 R -.25(Fe)2.5 G(atur).25 E +(es in Bash-1.14)-.18 E F0 .884(The ne)97 672 R 3.384(wf)-.25 G .884 +(eatures a)-3.384 F -.25(va)-.2 G .884(ilable in Bash-1.14 answer se).25 +F -.15(ve)-.25 G .883(ral of the most common requests for enhance-).15 F +2.931(ments. Most)72 684 R(notably)2.931 E 2.931(,t)-.65 G .432(here is\ + a mechanism for including non-visible character sequences in prompts, \ +such)-2.931 F .136 +(as those which cause a terminal to print characters in dif)72 696 R +.135(ferent colors or in standout mode.)-.25 F .135(There w)5.135 F .135 +(as noth-)-.1 F .558(ing pre)72 708 R -.15(ve)-.25 G .558 +(nting the use of these sequences in earlier v).15 F .559(ersions, b) +-.15 F .559(ut the readline redisplay algorithm assumed)-.2 F +(each character occupied ph)72 720 Q(ysical screen space and w)-.05 E +(ould wrap lines prematurely)-.1 E(.)-.65 E EP +%%Page: 9 9 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(-9-)282.17 48 Q .13(Readline has a fe)97 84 R +2.63(wn)-.25 G .63 -.25(ew va)-2.63 H .13(riables, se).25 F -.15(ve)-.25 +G .13(ral ne).15 F 2.63(wb)-.25 G .13 +(indable commands, and some additional emacs mode)-2.63 F(def)72 96 Q +.918(ault k)-.1 F 1.218 -.15(ey b)-.1 H 3.418(indings. A).15 F(ne)3.418 +E 3.418(wh)-.25 G .919(istory search mode has been implemented: in this\ + mode, readline searches)-3.418 F .336(the history for lines be)72 108 R +.336(ginning with the characters between the be)-.15 F .336 +(ginning of the current line and the cursor)-.15 F(.)-.55 E .555(The e) +72 120 R .556(xisting readline incremental search commands no longer ma\ +tch identical lines more than once.)-.15 F(File-)5.556 E 1.979 +(name completion no)72 132 R 4.479(we)-.25 G 1.979(xpands v)-4.629 F +1.979(ariables in directory names.)-.25 F 1.978(The history e)6.978 F +1.978(xpansion f)-.15 F 1.978(acilities are no)-.1 F(w)-.25 E 1.449 +(nearly completely csh-compatible: missing modi\214ers ha)72 144 R 1.749 +-.15(ve b)-.2 H 1.449(een added and history substitution has been).15 F +-.15(ex)72 156 S(tended.).15 E(Se)97 171.6 Q -.15(ve)-.25 G .474 +(ral of the features described earlier).15 F 2.973(,s)-.4 G .473(uch as) +-2.973 F/F1 10/Times-Bold@0 SF .473(set -o posix)2.973 F F0(and)2.973 E +F1($POSIX_PED)2.973 E(ANTIC)-.35 E F0 2.973(,a)C .473(re ne)-2.973 F +2.973(wi)-.25 G(n)-2.973 E -.15(ve)72 183.6 S .106(rsion 1.14.).15 F +.106(There is a ne)5.106 F 2.606(ws)-.25 G .106(hell v)-2.606 F +(ariable,)-.25 E F1(OSTYPE)2.606 E F0 2.606(,t)C 2.606(ow)-2.606 G .106 +(hich Bash assigns a v)-2.606 F .106(alue that identi\214es the v)-.25 F +(er)-.15 E(-)-.2 E 1.38(sion of)72 195.6 R/F2 9/Times-Roman@0 SF(UNIX) +3.88 E F0(it')3.88 E 3.879(sr)-.55 G 1.379(unning on \(great for puttin\ +g architecture-speci\214c binary directories into the)-3.879 F F1($P) +3.879 E -.95(AT)-.74 G(H).95 E F0(\).)A -1 -.8(Tw o)72 207.6 T -.25(va) +6.215 G 2.915(riables ha).25 F 3.215 -.15(ve b)-.2 H 2.915(een renamed:) +.15 F F1($HISTCONTR)5.416 E(OL)-.3 E F0(replaces)5.416 E F1 +($history_contr)5.416 E(ol)-.18 E F0 5.416(,a)C(nd)-5.416 E F1 +($HOSTFILE)5.416 E F0(replaces)72 219.6 Q F1 +($hostname_completion_\214le)2.521 E F0 5.021(.I)C 2.521(nb)-5.021 G +.021(oth cases, the old names are accepted for backw)-2.521 F .02 +(ards compatibil-)-.1 F(ity)72 231.6 Q 5.788(.T)-.65 G .788(he ksh) +-5.788 F/F3 10/Times-Italic@0 SF(select)3.288 E F0 .788 +(construct, which allo)3.288 F .788 +(ws the generation of simple menus, has been implemented.)-.25 F(Ne) +5.788 E(w)-.25 E 1.496(capabilities ha)72 243.6 R 1.796 -.15(ve b)-.2 H +1.496(een added to e).15 F 1.495(xisting v)-.15 F(ariables:)-.25 E F1 +($auto_r)3.995 E(esume)-.18 E F0 1.495(can no)3.995 F 3.995(wt)-.25 G +(ak)-3.995 E 3.995(ev)-.1 G 1.495(alues of)-4.245 F F3 -.2(ex)3.995 G +(act).2 E F0(or)3.995 E F3(sub-)3.995 E(string)72 255.6 Q F0 4.843(,a)C +(nd)-4.843 E F1($HISTCONTR)4.843 E(OL)-.3 E F0 2.343(understands the v) +4.843 F(alue)-.25 E F3(ignor)4.844 E(eboth)-.37 E F0 4.844(,w)C 2.344 +(hich combines the tw)-4.844 F 4.844(op)-.1 G(re)-4.844 E(viously)-.25 E +1.556(acceptable v)72 267.6 R 4.056(alues. The)-.25 F F1(dirs)4.056 E F0 +-.2(bu)4.056 G 1.556(iltin has acquired options to print out speci\214c\ + members of the directory).2 F 3.062(stack. The)72 279.6 R F1($nolinks) +3.062 E F0 -.25(va)3.062 G .562(riable, which forces a ph).25 F .562 +(ysical vie)-.05 F 3.062(wo)-.25 G 3.062(ft)-3.062 G .563 +(he \214le system, has been superseded by the)-3.062 F F1<ad50>72 291.6 +Q F0 .494(option to the)2.994 F F1(set)2.994 E F0 -.2(bu)2.994 G .494 +(iltin \(equi).2 F -.25(va)-.25 G .494(lent to).25 F F1 .494(set -o ph) +2.994 F(ysical)-.15 E F0 .493(\); the v)B .493 +(ariable is retained for backw)-.25 F .493(ards compati-)-.1 F(bility)72 +303.6 Q 5.196(.T)-.65 G .196(he v)-5.196 F .196 +(ersion string contained in)-.15 F F1($B)2.696 E(ASH_VERSION)-.3 E F0 +(no)2.696 E 2.696(wi)-.25 G .196(ncludes an indication of the patch le) +-2.696 F -.15(ve)-.25 G 2.696(la).15 G(s)-2.696 E .85(well as the \231b) +72 315.6 R .85(uild v)-.2 F 3.35(ersion\232. Some)-.15 F .85 +(little-used features ha)3.35 F 1.15 -.15(ve b)-.2 H .85(een remo).15 F +-.15(ve)-.15 G 3.35(d: the).15 F F1(by)3.35 E(e)-.1 E F0(synon)3.35 E +.85(ym for)-.15 F F1(exit)3.35 E F0(and)3.35 E(the)72 327.6 Q F1($NO_PR) +3.498 E(OMPT_V)-.3 E(ARS)-1.35 E F0 -.25(va)3.498 G .998 +(riable are gone.).25 F .998(There is no)5.998 F 3.498(wa)-.25 G 3.498 +(no)-3.498 G -2.19 -.18(rg a)-3.498 H .998 +(nized test suite that can be run as a).18 F(re)72 339.6 Q +(gression test when b)-.15 E(uilding a ne)-.2 E 2.5(wv)-.25 G +(ersion of Bash.)-2.65 E 1.696(The documentation has been thoroughly o) +97 355.2 R -.15(ve)-.15 G 1.696(rhauled: there is a ne).15 F 4.196(wm) +-.25 G 1.695(anual page on the readline)-4.196 F .467(library and the)72 +367.2 R F3(info)2.967 E F0 .467 +(\214le has been updated to re\215ect the current v)2.967 F 2.968 +(ersion. As)-.15 F(al)2.968 E -.1(wa)-.1 G .468(ys, as man).1 F 2.968 +(yb)-.15 G .468(ugs as possi-)-3.168 F(ble ha)72 379.2 Q .3 -.15(ve b) +-.2 H(een \214x).15 E(ed, although some surely remain.)-.15 E F1 2.5 +(5.2. Other)72 403.2 R -.25(Fe)2.5 G(atur).25 E(es)-.18 E F0 1.68 +(There are a fe)97 418.8 R 4.18(wf)-.25 G 1.68 +(eatures that I hope to include in later Bash releases.)-4.18 F 1.68 +(Some are based on w)6.68 F(ork)-.1 E(already done in other shells.)72 +430.8 Q .958(In addition to simple v)97 446.4 R .959(ariables, a future\ + release of Bash will include one-dimensional arrays, using)-.25 F .206 +(the ksh implementation of arrays as a model.)72 458.4 R .205 +(Additions to the ksh syntax, such as)5.205 F F3(varname)2.705 E F0 .205 +(=\( ... \) to assign)B 2.587(al)72 470.4 S .087(ist of w)-2.587 F .088 +(ords directly to an array and a mechanism to allo)-.1 F 2.588(wt)-.25 G +(he)-2.588 E F1 -.18(re)2.588 G(ad).18 E F0 -.2(bu)2.588 G .088 +(iltin to read a list of v).2 F .088(alues directly)-.25 F .092 +(into an array)72 482.4 R 2.592(,w)-.65 G .092(ould be desirable.)-2.692 +F(Gi)5.092 E -.15(ve)-.25 G 2.592(nt).15 G .092(hose e)-2.592 F .092 +(xtensions, the ksh)-.15 F F1 .092(set \255A)2.592 F F0 .091 +(syntax may not be w)2.591 F .091(orth support-)-.1 F(ing \(the)72 494.4 +Q F1<ad41>2.5 E F0(option assigns a list of v)2.5 E(alues to an array) +-.25 E 2.5(,b)-.65 G(ut is a rather peculiar special case\).)-2.7 E .76 +(Some shells include a means of)97 510 R F3(pr)3.26 E -.1(og)-.45 G -.15 +(ra).1 G(mmable).15 E F0 -.1(wo)3.26 G .76 +(rd completion, where the user speci\214es on a per).1 F(-)-.2 E .163 +(command basis ho)72 522 R 2.663(wt)-.25 G .163(he ar)-2.663 F .163(gum\ +ents of the command are to be treated when completion is attempted: as \ +\214le-)-.18 F .194(names, hostnames, e)72 534 R -.15(xe)-.15 G .194 +(cutable \214les, and so on.).15 F .195 +(The other aspects of the current Bash implementation could)5.195 F .482 +(remain as-is; the e)72 546 R .482(xisting heuristics w)-.15 F .481 +(ould still be v)-.1 F 2.981(alid. Only)-.25 F .481 +(when completing the ar)2.981 F .481(guments to a simple)-.18 F +(command w)72 558 Q(ould the programmable completion be in ef)-.1 E +(fect.)-.25 E .479(It w)97 573.6 R .479(ould also be nice to gi)-.1 F +.779 -.15(ve t)-.25 H .479(he user \214ner).15 F .479 +(-grained control o)-.2 F -.15(ve)-.15 G 2.98(rw).15 G .48 +(hich commands are sa)-2.98 F -.15(ve)-.2 G 2.98(do).15 G .48(nto the) +-2.98 F 1.786(history list.)72 585.6 R 1.786(One proposal is for a v) +6.786 F 1.786(ariable, tentati)-.25 F -.15(ve)-.25 G 1.786(ly named).15 +F F1(HISTIGNORE)4.286 E F0 4.285(,w)C 1.785(hich w)-4.285 F 1.785 +(ould contain a)-.1 F .496(colon-separated list of commands.)72 597.6 R +.496(Lines be)5.496 F .496 +(ginning with these commands, after the restrictions of)-.15 F F1($HIST) +2.997 E(-)-.92 E(CONTR)72 609.6 Q(OL)-.3 E F0(ha)2.65 E .45 -.15(ve b) +-.2 H .15(een applied, w).15 F .15 +(ould not be placed onto the history list.)-.1 F .15 +(The shell pattern-matching capa-)5.15 F(bilities could also be a)72 +621.6 Q -.25(va)-.2 G(ilable when specifying the contents of).25 E F1 +($HISTIGNORE)2.5 E F0(.)A .729(One thing that ne)97 637.2 R .729 +(wer shells such as)-.25 F F1(wksh)3.229 E F0 .729(\(also kno)3.229 F +.729(wn as)-.25 F F1(dtksh)3.23 E F0 3.23(\)p)C(ro)-3.23 E .73 +(vide is a command to dynami-)-.15 F 1.189 +(cally load code implementing additional b)72 649.2 R 1.189 +(uiltin commands into a running shell.)-.2 F 1.188(This ne)6.188 F 3.688 +(wb)-.25 G 1.188(uiltin w)-3.888 F(ould)-.1 E(tak)72 661.2 Q 2.875(ea) +-.1 G 2.875(no)-2.875 G .375 +(bject \214le or shared library implementing the \231body\232 of the b) +-2.875 F .375(uiltin \()-.2 F F3(xxx_b)A(uiltin\(\))-.2 E F0 .375 +(for those f)2.875 F(amiliar)-.1 E .052 +(with Bash internals\) and a structure containing the name of the ne)72 +673.2 R 2.552(wc)-.25 G .051(ommand, the function to call when the) +-2.552 F(ne)72 685.2 Q 3.458(wb)-.25 G .958(uiltin is in)-3.658 F -.2 +(vo)-.4 G -.1(ke).2 G 3.458(d\().1 G .959 +(presumably de\214ned in the shared object speci\214ed as an ar)-3.458 F +.959(gument\), and the docu-)-.18 F 1.352 +(mentation to be printed by the)72 697.2 R F1(help)3.851 E F0 1.351 +(command \(possibly present in the shared object as well\).)3.851 F +1.351(It w)6.351 F(ould)-.1 E(manage the details of e)72 709.2 Q +(xtending the internal table of b)-.15 E(uiltins.)-.2 E EP +%%Page: 10 10 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(-10-)279.67 48 Q 3.291(Af)97 84 S 1.291 -.25 +(ew o)-3.291 H .791(ther b).25 F .791(uiltins w)-.2 F .791 +(ould also be desirable: tw)-.1 F 3.291(oa)-.1 G .791(re the POSIX.2) +-3.291 F/F1 10/Times-Bold@0 SF(getconf)3.292 E F0 .792 +(command, which prints)3.292 F 1.412(the v)72 96 R 1.412 +(alues of system con\214guration v)-.25 F 1.411 +(ariables de\214ned by POSIX.2, and a)-.25 F F1(diso)3.911 E(wn)-.1 E F0 +-.2(bu)3.911 G 1.411(iltin, which causes a).2 F 1.347 +(shell running with job control acti)72 108 R 1.647 -.15(ve t)-.25 H +3.847<6f99>.15 G(for)-3.847 E 1.347 +(get about\232 one or more background jobs in its internal jobs)-.18 F +3.465(table. Using)72 120 R F1(getconf)3.465 E F0 3.465(,f)C .965(or e) +-3.465 F .965(xample, a user could retrie)-.15 F 1.264 -.15(ve a v)-.25 +H .964(alue for)-.1 F F1($P)3.464 E -.95(AT)-.74 G(H).95 E F0 .964 +(guaranteed to \214nd all of the)3.464 F .884 +(POSIX standard utilities, or \214nd out ho)72 132 R 3.385(wl)-.25 G +.885 +(ong \214lenames may be in the \214le system containing a speci\214ed) +-3.385 F(directory)72 144 Q(.)-.65 E 1.521 +(There are no implementation timetables for an)97 159.6 R 4.021(yo)-.15 +G 4.021(ft)-4.021 G 1.52(hese features, nor are there concrete plans to) +-4.021 F(include them.)72 171.6 Q(If an)5 E(yone has comments on these \ +proposals, feel free to send me electronic mail.)-.15 E F1 2.5 +(6. Re\215ections)72 195.6 R(and Lessons Lear)2.5 E(ned)-.15 E F0 .433 +(The lesson that has been repeated most often during Bash de)97 211.2 R +-.15(ve)-.25 G .433(lopment is that there are dark corners).15 F .181 +(in the Bourne shell, and people use all of them.)72 223.2 R .18 +(In the original description of the Bourne shell, quoting and)5.181 F +.073(the shell grammar are both poorly speci\214ed and incomplete; subs\ +equent descriptions ha)72 235.2 R .373 -.15(ve n)-.2 H .073 +(ot helped much.).15 F 1.856(The grammar presented in Bourne')72 247.2 R +4.356(sp)-.55 G 1.856(aper describing the shell distrib)-4.356 F 1.855 +(uted with the Se)-.2 F -.15(ve)-.25 G 1.855(nth Edition of).15 F/F2 9 +/Times-Roman@0 SF(UNIX)72 259.2 Q F0 2.5<8769>C 2.5(ss)-2.5 G 2.5(of) +-2.5 G(ar of)-2.6 E 2.5(ft)-.25 G(hat it does not allo)-2.5 E 2.5(wt) +-.25 G(he command)-2.5 E/F3 10/Courier@0 SF(who|wc)2.5 E F0 5(.I)C 2.5 +(nf)-5 G(act, as T)-2.6 E(om Duf)-.8 E 2.5(fs)-.25 G(tates:)-2.5 E 1.375 +(Nobody really kno)97 274.8 R 1.375(ws what the Bourne shell')-.25 F +3.875(sg)-.55 G 1.375(rammar is.)-3.875 F(Ev)6.376 E 1.376(en e)-.15 F +1.376(xamination of the source)-.15 F(code is little help.\210)97 286.8 +Q .382(The POSIX.2 standard includes a)72 302.4 R/F4 10/Times-Italic@0 +SF(yacc)2.882 E F0 .382 +(grammar that comes close to capturing the Bourne shell')2.882 F 2.882 +(sb)-.55 G(eha)-2.882 E(vior)-.2 E(,)-.4 E -.2(bu)72 314.4 S 3.246(ti).2 +G 3.246(td)-3.246 G(isallo)-3.246 E .747(ws some constructs which sh ac\ +cepts without complaint \255 and there are scripts out there that)-.25 F +.501(use them.)72 326.4 R .501(It took a fe)5.501 F 3.001(wv)-.25 G .501 +(ersions and se)-3.151 F -.15(ve)-.25 G .501(ral b).15 F .5 +(ug reports before Bash implemented sh-compatible quoting,)-.2 F .279 +(and there are still some \231le)72 338.4 R -.05(ga)-.15 G .279 +(l\232 sh constructs which Bash \215ags as syntax errors.).05 F .28 +(Complete sh compatibility)5.28 F(is a tough nut.)72 350.4 Q 1.231 +(The shell is bigger and slo)97 366 R 1.231(wer than I w)-.25 F 1.231 +(ould lik)-.1 F 1.23(e, though the current v)-.1 F 1.23 +(ersion is substantially f)-.15 F(aster)-.1 E .086(than pre)72 378 R +(viously)-.25 E 5.086(.T)-.65 G .087 +(he readline library could stand a substantial re)-5.086 F 2.587 +(write. A)-.25 F .087(hand-written parser to replace the)2.587 F +(current)72 390 Q F4(yacc)2.978 E F0 .478(-generated one w)B .477 +(ould probably result in a speedup, and w)-.1 F .477(ould solv)-.1 F +2.977(eo)-.15 G .477(ne glaring problem:)-2.977 F(the)5.477 E .384 +(shell could parse commands in \231$\(...\)\232 constructs as the)72 402 +R 2.884(ya)-.15 G .385 +(re entered, rather than reporting errors when the)-2.884 F +(construct is e)72 414 Q(xpanded.)-.15 E 1.064(As al)97 429.6 R -.1(wa) +-.1 G 1.064(ys, there is some chaf).1 F 3.564(ft)-.25 G 3.564(og)-3.564 +G 3.564(ow)-3.564 G 1.064(ith the wheat.)-3.564 F 1.063 +(Areas of duplicated functionality need to be)6.063 F .382(cleaned up.) +72 441.6 R .382(There are se)5.382 F -.15(ve)-.25 G .382 +(ral cases where Bash treats a v).15 F .382 +(ariable specially to enable functionality a)-.25 F -.25(va)-.2 G +(ilable).25 E .185(another w)72 453.6 R .185(ay \()-.1 F F1($notify)A F0 +(vs.)2.684 E F1 .184(set -o notify)5.184 F F0(and)2.684 E F1($nolinks) +2.684 E F0(vs.)2.684 E F1 .184(set -o ph)2.684 F(ysical)-.15 E F0 2.684 +(,f)C .184(or instance\); the special treatment)-2.684 F 3.421(of the v) +72 465.6 R 3.421(ariable name should probably be remo)-.25 F -.15(ve) +-.15 G 5.921(d. A).15 F(fe)5.921 E 5.921(wm)-.25 G 3.422 +(ore things could stand remo)-5.921 F -.25(va)-.15 G 3.422(l; the).25 F +F1($allo)72 477.6 Q(w_null_glob_expansion)-.1 E F0(and)4.112 E F1 +($glob_dot_\214lenames)4.112 E F0 -.25(va)4.111 G 1.611 +(riables are of particularly questionable v).25 F(alue.)-.25 E(The)72 +489.6 Q F1($[...])3.977 E F0 1.477(arithmetic e)3.977 F -.25(va)-.25 G +1.478(luation syntax is redundant no).25 F 3.978(wt)-.25 G 1.478 +(hat the POSIX-mandated)-3.978 F F1($\(\(...\)\))3.978 E F0 1.478 +(construct has)3.978 F .326(been implemented, and could be deleted.)72 +501.6 R .326(It w)5.326 F .326(ould be nice if the te)-.1 F .326 +(xt output by the)-.15 F F1(help)2.825 E F0 -.2(bu)2.825 G .325 +(iltin were e).2 F(xter)-.15 E(-)-.2 E .061 +(nal to the shell rather than compiled into it.)72 513.6 R .062 +(The beha)5.062 F .062(vior enabled by)-.2 F F1 +($command_oriented_history)2.562 E F0 2.562(,w)C(hich)-2.562 E 1.125 +(causes the shell to attempt to sa)72 525.6 R 1.424 -.15(ve a)-.2 H +1.124(ll lines of a multi-line command in a single history entry).15 F +3.624(,s)-.65 G 1.124(hould be)-3.624 F(made the def)72 537.6 Q +(ault and the v)-.1 E(ariable remo)-.25 E -.15(ve)-.15 G(d.).15 E F1 2.5 +(7. A)72 561.6 R -.1(va)-1 G(ilability).1 E F0 .047 +(As with all other GNU softw)97 577.2 R .047(are, Bash is a)-.1 F -.25 +(va)-.2 G .047(ilable for anon).25 F .047(ymous FTP from)-.15 F F4(pr) +2.547 E(ep.ai.mit.edu:/pub/gnu)-.37 E F0 1.05(and from other GNU softw) +72 589.2 R 1.05(are mirror sites.)-.1 F 1.049(The current v)6.049 F +1.049(ersion is in)-.15 F F4(bash-1.14.1.tar)3.549 E(.gz)-1.11 E F0 +1.049(in that directory)3.549 F(.)-.65 E(Use)72 601.2 Q F4(ar)5.965 E +-.15(ch)-.37 G(ie).15 E F0 3.465(to \214nd the nearest archi)5.965 F +3.766 -.15(ve s)-.25 H 5.966(ite. The).15 F 3.466(latest v)5.966 F 3.466 +(ersion is al)-.15 F -.1(wa)-.1 G 3.466(ys a).1 F -.25(va)-.2 G 3.466 +(ilable for FTP from).25 F F4(bash.CWR)72 613.2 Q -.25(U.)-.4 G +(Edu:/pub/dist.).25 E F0(Bash documentation is a)5 E -.25(va)-.2 G +(ilable for FTP from).25 E F4(bash.CWR)2.5 E -.25(U.)-.4 G +(Edu:/pub/bash.).25 E F0 1.169(The Free Softw)97 628.8 R 1.169(are F)-.1 +F 1.169(oundation sells tapes and CD-R)-.15 F 1.168 +(OMs containing Bash; send electronic mail to)-.4 F F3 +(gnu@prep.ai.mit.edu)72 640.8 Q F0(or call)2.5 E F3(+1-617-876-3296)2.5 +E F0(for more information.)2.5 E .694(Bash is also distrib)97 656.4 R +.694(uted with se)-.2 F -.15(ve)-.25 G .694(ral v).15 F .694(ersions of) +-.15 F F2(UNIX)3.194 E F0 .694(-compatible systems.)B .695 +(It is included as /bin/sh)5.694 F .948(and /bin/bash on se)72 668.4 R +-.15(ve)-.25 G .948(ral Linux distrib).15 F .948 +(utions \(more about the dif)-.2 F .948 +(ference in a moment\), and as contrib)-.25 F(uted)-.2 E .32 LW 144 +676.4 72 676.4 DL/F5 8/Times-Roman@0 SF .781 +(\207S. R. Bourne, \231UNIX T)72 688.2 R .781(ime-Sharing System:)-.28 F +.781(The UNIX Shell\232,)4.781 F/F6 8/Times-Italic@0 SF .78 +(Bell System T)2.78 F(ec)-.736 E .78(hnical J)-.12 F(ournal)-.2 E F5 +2.78(,5)C .78(7\(6\), July-)-2.78 F(August, 1978, pp. 1971-1990.)72 +698.2 Q<8854>72 710 Q .431(om Duf)-.64 F .431 +(f, \231Rc \255 A Shell for Plan 9 and)-.2 F/F7 7/Times-Roman@0 SF(UNIX) +2.432 E F5(systems\232,)2.432 E F6(Pr)2.432 E .432 +(oc. of the Summer 1990 EUUG Confer)-.36 F(ence)-.296 E F5 2.432(,L)C +(on-)-2.432 E(don, July)72 720 Q 2(,1)-.52 G(990, pp. 21-33.)-2 E EP +%%Page: 11 11 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF(-11-)279.67 48 Q(softw)72 84 Q(are in BSDI')-.1 +E 2.5(sB)-.55 G(SD/386* and FreeBSD.)-2.5 E .598(The Linux distrib)97 +99.6 R .598(ution deserv)-.2 F .598(es special mention.)-.15 F .598 +(There are tw)5.598 F 3.099(oc)-.1 G .599 +(on\214gurations included in the stan-)-3.099 F .733(dard Bash distrib) +72 111.6 R .732(ution: a \231normal\232 con\214guration, in which all o\ +f the standard features are included, and a)-.2 F .519(\231minimal\232 \ +con\214guration, which omits job control, aliases, history and command \ +line editing, the directory)72 123.6 R .886(stack and)72 135.6 R/F1 10 +/Times-Bold@0 SF(pushd/popd/dirs,)3.386 E F0 .886(process substitution,\ + prompt string special character decoding, and the)3.386 F/F2 10 +/Times-Italic@0 SF(select)3.385 E F0 3.368(construct. This)72 147.6 R +.868(minimal v)3.368 F .869 +(ersion is designed to be a drop-in replacement for the traditional)-.15 +F/F3 9/Times-Roman@0 SF(UNIX)3.369 E F0(/bin/sh,)3.369 E +(and is included as the Linux /bin/sh in se)72 159.6 Q -.15(ve)-.25 G +(ral packagings.).15 E F1 2.5(8. Conclusion)72 183.6 R F0 .8 +(Bash is a w)97 199.2 R(orth)-.1 E 3.3(ys)-.05 G .8(uccessor to sh.)-3.3 +F .8(It is suf)5.8 F .8(\214ciently portable to run on nearly e)-.25 F +-.15(ve)-.25 G .8(ry v).15 F .8(ersion of)-.15 F F3(UNIX)3.299 E F0 .31 +(from 4.3 BSD to SVR4.2, and se)72 211.2 R -.15(ve)-.25 G(ral).15 E F3 +(UNIX)2.81 E F0 -.1(wo)2.81 G(rkalik).1 E 2.81(es. It)-.1 F .311(is rob) +2.81 F .311(ust enough to replace sh on most of those)-.2 F 1.515 +(systems, and pro)72 223.2 R 1.515(vides more functionality)-.15 F 6.515 +(.I)-.65 G 4.015(th)-6.515 G 1.515(as se)-4.015 F -.15(ve)-.25 G 1.515 +(ral thousand re).15 F 1.515(gular users, and their feedback has)-.15 F +(helped to mak)72 235.2 Q 2.5(ei)-.1 G 2.5(ta)-2.5 G 2.5(sg)-2.5 G +(ood as it is today \255 a testament to the bene\214ts of free softw) +-2.5 E(are.)-.1 E .32 LW 144 708.2 72 708.2 DL/F4 8/Times-Roman@0 SF +(*BSD/386 is a trademark of Berk)72 720 Q(ele)-.08 E 2(yS)-.12 G(oftw)-2 +E(are Design, Inc.)-.08 E EP +%%Trailer +end +%%EOF @@ -1,17 +1,17 @@ -.\" +\" .\" MAN PAGE COMMENTS to .\" .\" Chet Ramey .\" Information Network Services .\" Case Western Reserve University -.\" chet@po.CWRU.Edu +.\" chet@po.cwru.edu .\" -.\" Last Change: Sat Jun 26 14:26:44 EDT 2004 +.\" Last Change: Sat Aug 27 13:28:44 EDT 2005 .\" .\" bash_builtins, strip all but Built-Ins section .if \n(zZ=1 .ig zZ .if \n(zY=1 .ig zY -.TH BASH 1 "2004 June 26" "GNU Bash-3.0" +.TH BASH 1 "2005 Aug 27" "GNU Bash-3.1-beta1" .\" .\" There's some problem with having a `@' .\" in a tagged paragraph with the BSD man macros. @@ -51,8 +51,8 @@ bash \- GNU Bourne-Again SHell [options] [file] .SH COPYRIGHT -.if n Bash is Copyright (C) 1989-2004 by the Free Software Foundation, Inc. -.if t Bash is Copyright \(co 1989-2004 by the Free Software Foundation, Inc. +.if n Bash is Copyright (C) 1989-2005 by the Free Software Foundation, Inc. +.if t Bash is Copyright \(co 1989-2005 by the Free Software Foundation, Inc. .SH DESCRIPTION .B Bash is an \fBsh\fR-compatible command language interpreter that @@ -64,6 +64,8 @@ shells (\fBksh\fP and \fBcsh\fP). .B Bash is intended to be a conformant implementation of the IEEE POSIX Shell and Tools specification (IEEE Working Group 1003\.2). +.B Bash +can be configured to be POSIX-conformant by default. .SH OPTIONS In addition to the single-character shell options documented in the description of the \fBset\fR builtin command, \fBbash\fR @@ -115,7 +117,7 @@ when invoking an interactive shell. .TP .B \-D A list of all double-quoted strings preceded by \fB$\fP -is printed on the standard ouput. +is printed on the standard output. These are the strings that are subject to language translation when the current locale is not \fBC\fP or \fBPOSIX\fP. @@ -154,11 +156,13 @@ single-character options to be recognized. .TP .B \-\-debugger Arrange for the debugger profile to be executed before the shell -starts. Turns on extended debugging mode (see the description of the +starts. +Turns on extended debugging mode (see the description of the .B extdebug option to the .B shopt -builtin below) and shell function tracing (see the description of the +builtin below) +and shell function tracing (see the description of the \fB\-o functrace\fP option to the .B set builtin below). @@ -669,6 +673,10 @@ as primaries. When the \fB==\fP and \fB!=\fP operators are used, the string to the right of the operator is considered a pattern and matched according to the rules described below under \fBPattern Matching\fP. +If the shell option +.B nocasematch +is enabled, the match is performed without regard to the case +of alphabetic characters. The return value is 0 if the string matches or does not match the pattern, respectively, and 1 otherwise. Any part of the pattern may be quoted to force it to be matched as a @@ -684,7 +692,7 @@ the pattern, and 1 otherwise. If the regular expression is syntactically incorrect, the conditional expression's return value is 2. If the shell option -.B nocaseglob +.B nocasematch is enabled, the match is performed without regard to the case of alphabetic characters. Substrings matched by parenthesized subexpressions within the regular @@ -798,7 +806,12 @@ A \fBcase\fP command first expands \fIword\fP, and tries to match it against each \fIpattern\fP in turn, using the same matching rules as for pathname expansion (see .B Pathname Expansion -below). When a match is found, the +below). +If the shell option +.B nocasematch +is enabled, the match is performed without regard to the case +of alphabetic characters. +When a match is found, the corresponding \fIlist\fP is executed. After the first match, no subsequent matches are attempted. The exit status is zero if no pattern matches. Otherwise, it is the exit status of the @@ -895,7 +908,11 @@ Each of the \fImetacharacters\fP listed above under has special meaning to the shell and must be quoted if it is to represent itself. .PP -When the command history expansion facilities are being used, the +When the command history expansion facilities are being used +(see +.SM +.B HISTORY EXPANSION +below), the \fIhistory expansion\fP character, usually \fB!\fP, must be quoted to prevent history expansion. .PP @@ -919,8 +936,9 @@ Enclosing characters in double quotes preserves the literal value of all characters within the quotes, with the exception of .BR $ , .BR ` , -and -.BR \e . +.BR \e , +and, when history expansion is enabled, +.BR ! . The characters .B $ and @@ -936,8 +954,12 @@ or .BR <newline> . A double quote may be quoted within double quotes by preceding it with a backslash. -When command history is being used, the double quote may not be used to -quote the history expansion character. +If enabled, history expansion will be performed unless an +.B ! +appearing in double quotes is escaped using a backslash. +The backslash preceding the +.B ! +is not removed. .PP The special parameters .B * @@ -951,7 +973,7 @@ below). .PP Words of the form \fB$\fP'\fIstring\fP' are treated specially. The word expands to \fIstring\fP, with backslash-escaped characters replaced -as specifed by the ANSI C standard. Backslash escape sequences, if +as specified by the ANSI C standard. Backslash escape sequences, if present, are decoded as follows: .RS .PD 0 @@ -1076,6 +1098,20 @@ Assignment statements may also appear as arguments to the and .B local builtin commands. +.PP +In the context where an assignment statement is assigning a value +to a shell variable or array index, the += operator can be used to +append to or add to the variable's previous value. +When += is applied to a variable for which the integer attribute has been +set, \fIvalue\fP is evaluated as an arithmetic expression and added to the +variable's current value, which is also evaluated. +When += is applied to an array variable using compound assignment (see +.B Arrays +below), the +variable's value is not unset (as it is when using =), and new values are +appended to the array beginning at one greater than the array's maximum index. +When applied to a string-valued variable, \fIvalue\fP is expanded and +appended to the variable's value. .SS Positional Parameters .PP A @@ -1130,6 +1166,10 @@ Expands to the positional parameters, starting from one. When the expansion occurs within double quotes, each parameter expands to a separate word. That is, "\fB$@\fP" is equivalent to "\fB$1\fP" "\fB$2\fP" ... +If the double-quoted expansion occurs within a word, the expansion of +the first parameter is joined with the beginning part of the original +word, and the expansion of the last parameter is joined with the last +part of the original word. When there are no positional parameters, "\fB$@\fP" and .B $@ expand to nothing (i.e., they are removed). @@ -1178,12 +1218,13 @@ to the file name used to invoke as given by argument zero. .TP .B _ -At shell startup, set to the absolute file name of the shell or shell -script being executed as passed in the argument list. +At shell startup, set to the absolute pathname used to invoke the +shell or shell script being executed as passed in the environment +or argument list. Subsequently, expands to the last argument to the previous command, after expansion. -Also set to the full file name of each command executed and placed in -the environment exported to that command. +Also set to the full pathname used to invoke each command executed +and placed in the environment exported to that command. When checking mail, this parameter holds the name of the mail file currently being checked. .PD @@ -1199,11 +1240,18 @@ Expands to the full file name used to invoke this instance of .TP .B BASH_ARGC An array variable whose values are the number of parameters in each -frame of the current bash execution call stack. The number of +frame of the current bash execution call stack. +The number of parameters to the current subroutine (shell function or script executed -with \fB.\fP or \fBsource\fP) is at the top of the stack. When a -subroutine is executed, the number of parameters passed is pushed onto +with \fB.\fP or \fBsource\fP) is at the top of the stack. +When a subroutine is executed, the number of parameters passed is pushed onto \fBBASH_ARGC\fP. +The shell sets \fBBASH_ARGC\fP only when in extended debugging mode +(see the description of the +.B extdebug +option to the +.B shopt +builtin below) .TP .B BASH_ARGV An array variable containing all of the parameters in the current bash @@ -1211,6 +1259,12 @@ execution call stack. The final parameter of the last subroutine call is at the top of the stack; the first parameter of the initial call is at the bottom. When a subroutine is executed, the parameters supplied are pushed onto \fBBASH_ARGV\fP. +The shell sets \fBBASH_ARGV\fP only when in extended debugging mode +(see the description of the +.B extdebug +option to the +.B shopt +builtin below) .TP .B BASH_COMMAND The command currently being executed or about to be executed, unless the @@ -1222,10 +1276,10 @@ The command argument to the \fB\-c\fP invocation option. .TP .B BASH_LINENO An array variable whose members are the line numbers in source files -corresponding to each member of @var{FUNCNAME}. +corresponding to each member of \fBFUNCNAME\fP. \fB${BASH_LINENO[\fP\fI$i\fP\fB]}\fP is the line number in the source -file where \fB${FUNCNAME[\fP\fI$i + 1\fP\fB]}\fP was called. -The corresponding source file name is \fB${BASH_SOURCE[\fP\fI$i + 1\fP\fB]}\fB. +file where \fB${FUNCNAME[\fP\fI$ifP\fB]}\fP was called. +The corresponding source file name is \fB${BASH_SOURCE[\fP\fI$i\fP\fB]}\fB. Use \fBLINENO\fP to obtain the current line number. .TP .B BASH_REMATCH @@ -1934,6 +1988,10 @@ number of seconds to wait for input after issuing the primary prompt. terminates after waiting for that number of seconds if input does not arrive. .TP +.B TMPDIR +If set, \fBBash\fP uses its value as the name of a directory in which +\fBBash\fP creates temporary files for the shell's use. +.TP .B auto_resume This variable controls how the shell interacts with the user and job control. If this variable is set, single word simple @@ -1959,9 +2017,7 @@ job identifier (see .B JOB CONTROL below). If set to any other value, the supplied string must be a prefix of a stopped job's name; this provides functionality -analogous to the -.B % -job identifier. +analogous to the \fB%\fP\fIstring\fP job identifier. .TP .B histchars The two or three characters which control history expansion @@ -2035,7 +2091,12 @@ character of the .B IFS special variable, and ${\fIname\fP[@]} expands each element of \fIname\fP to a separate word. When there are no array members, -${\fIname\fP[@]} expands to nothing. This is analogous to the expansion +${\fIname\fP[@]} expands to nothing. +If the double-quoted expansion occurs within a word, the expansion of +the first parameter is joined with the beginning part of the original +word, and the expansion of the last parameter is joined with the last +part of the original word. +This is analogous to the expansion of the special parameters \fB*\fP and \fB@\fP (see .B Special Parameters above). ${#\fIname\fP[\fIsubscript\fP]} expands to the length of @@ -2048,6 +2109,8 @@ The .B unset builtin is used to destroy arrays. \fBunset\fP \fIname\fP[\fIsubscript\fP] destroys the array element at index \fIsubscript\fP. +Care must be taken to avoid unwanted side effects caused by filename +generation. \fBunset\fP \fIname\fP, where \fIname\fP is an array, or \fBunset\fP \fIname\fP[\fIsubscript\fP], where \fIsubscript\fP is \fB*\fP or \fB@\fP, removes the entire array. @@ -2229,7 +2292,7 @@ is unchanged. Each variable assignment is checked for unquoted tilde-prefixes immediately following a .B : -or +or the first .BR = . In these cases, tilde expansion is also performed. Consequently, one may use file names with tildes in assignments to @@ -2252,7 +2315,7 @@ interpreted as part of the name. .PP When braces are used, the matching ending brace is the first `\fB}\fP' not escaped by a backslash or within a quoted string, and not within an -embedded arithmetic expansion, command substitution, or paramter +embedded arithmetic expansion, command substitution, or parameter expansion. .PP .PD 0 @@ -2352,6 +2415,10 @@ parameters beginning at \fIoffset\fP. If \fIparameter\fP is an array name indexed by @ or *, the result is the \fIlength\fP members of the array beginning with ${\fIparameter\fP[\fIoffset\fP]}. +A negative \fIoffset\fP is taken relative to one greater than the maximum +index of the specified array. +Note that a negative offset must be separated from the colon by at least +one space to avoid being confused with the :- expansion. Substring indexing is zero-based unless the positional parameters are used, in which case the indexing starts at 1. .TP @@ -2846,7 +2913,7 @@ Matches zero or more occurrences of the given patterns Matches one or more occurrences of the given patterns .TP \fB@(\fP\^\fIpattern-list\^\fP\fB)\fP -Matches exactly one of the given patterns +Matches one of the given patterns .TP \fB!(\fP\^\fIpattern-list\^\fP\fB)\fP Matches anything except one of the given patterns @@ -2943,6 +3010,10 @@ a UDP connection to the corresponding socket. .RE .PP A failure to open or create a file causes the redirection to fail. +.PP +Redirections using file descriptors greater than 9 should be used with +care, as they may conflict with file descriptors the shell uses +internally. .SS Redirecting Input .PP Redirection of input causes the file whose name results from @@ -3291,19 +3362,21 @@ environment are identical between a function and its caller with the exception that the .SM .B DEBUG -trap (see the description of the +and +.B RETURN +traps (see the description of the .B trap builtin under .SM .B SHELL BUILTIN COMMANDS -below) is not inherited unless the function has been given the +below) are not inherited unless the function has been given the \fBtrace\fP attribute (see the description of the .SM .B declare builtin below) or the \fB\-o functrace\fP shell option has been enabled with the \fBset\fP builtin -(in which case all functions inherit the \fBDEBUG\fP trap). +(in which case all functions inherit the \fBDEBUG\fP and \fBRETURN\fP traps). .PP Variables local to the function may be declared with the .B local @@ -3442,7 +3515,7 @@ If \fIbase#\fP is omitted, then base 10 is used. The digits greater than 9 are represented by the lowercase letters, the uppercase letters, @, and _, in that order. If \fIbase\fP is less than or equal to 36, lowercase and uppercase -letters may be used interchangably to represent numbers between 10 +letters may be used interchangeably to represent numbers between 10 and 35. .PP Operators are evaluated in order of precedence. Sub-expressions in @@ -3458,6 +3531,9 @@ If any \fIfile\fP argument to one of the primaries is of the form If the \fIfile\fP argument to one of the primaries is one of \fI/dev/stdin\fP, \fI/dev/stdout\fP, or \fI/dev/stderr\fP, file descriptor 0, 1, or 2, respectively, is checked. +.PP +Unless otherwise specified, primaries that operate on files follow symbolic +links and operate on the target of the link, rather than the link itself. .sp 1 .PD 0 .TP @@ -3923,7 +3999,7 @@ sends a .B SIGHUP to all jobs when an interactive login shell exits. .PP -If \Bbash\fP is waiting for a command to complete and receives a signal +If \fBbash\fP is waiting for a command to complete and receives a signal for which a trap has been set, the trap will not be executed until the command completes. When \fBbash\fP is waiting for an asynchronous command via the \fBwait\fP @@ -4053,6 +4129,8 @@ command), the current job is always flagged with a .BR + , and the previous job with a .BR \- . +A single % (with no accompanying job specification) also refers to the +current job. .PP Simply naming a job can be used to bring it into the foreground: @@ -4489,7 +4567,12 @@ file with a statement of the form Except where noted, readline variables can take the values .B On or -.BR Off . +.B Off +(without regard to case). +Unrecognized variable names are ignored. +When a variable value is read, empty or null values, "on" (case-insensitive), +and "1" are equivalent to \fBOn\fP. All other values are equivalent to +\fBOff\fP. The variables and their default values are: .PP .PD 0 @@ -4500,6 +4583,11 @@ If set to \fBnone\fP, readline never rings the bell. If set to \fBvisible\fP, readline uses a visible bell if one is available. If set to \fBaudible\fP, readline attempts to ring the terminal's bell. .TP +.B bind\-tty\-special\-chars (On) +If set to \fBOn\fP, readline attempts to bind the control characters +treated specially by the kernel's terminal driver to their readline +equivalents. +.TP .B comment\-begin (``#'') The string that is inserted when the readline .B insert\-comment @@ -4553,9 +4641,9 @@ arrow keys. If set to \fBon\fP, tilde expansion is performed when readline attempts word completion. .TP -.B history-preserve-point +.B history\-preserve\-point (Off) If set to \fBon\fP, the history code attempts to place point at the -same location on each history line retrived with \fBprevious-history\fP +same location on each history line retrieved with \fBprevious-history\fP or \fBnext-history\fP. .TP .B horizontal\-scroll\-mode (Off) @@ -4855,6 +4943,8 @@ With an argument insert the \fIn\fPth word from the previous command (the words in the previous command begin with word 0). A negative argument inserts the \fIn\fPth word from the end of the previous command. +Once the argument \fIn\fP is computed, the argument is extracted +as if the "!\fIn\fP" history expansion had been specified. .TP .B yank\-last\-arg (M\-.\^, M\-_\^) @@ -4863,6 +4953,8 @@ the previous history entry). With an argument, behave exactly like \fByank\-nth\-arg\fP. Successive calls to \fByank\-last\-arg\fP move back through the history list, inserting the last argument of each line in turn. +The history expansion facilities are used to extract the last argument, +as if the "!$" history expansion had been specified. .TP .B shell\-expand\-line (M\-C\-e) Expand the line as the shell does. This @@ -5275,7 +5367,7 @@ of an \fIinputrc\fP file. .TP .B dump\-macros Print all of the readline key sequences bound to macros and the -strings they ouput. If a numeric argument is supplied, +strings they output. If a numeric argument is supplied, the output is formatted in such a way that it can be made part of an \fIinputrc\fP file. .TP @@ -5339,7 +5431,7 @@ special variable as delimiters. Shell quoting is honored. Each word is then expanded using brace expansion, tilde expansion, parameter and variable expansion, -command substitution, arithmetic expansion, and pathname expansion, +command substitution, and arithmetic expansion, as described above under .SM .BR EXPANSION . @@ -5806,6 +5898,8 @@ section as accepting options preceded by accepts .B \-\- to signify the end of the options. +For example, the \fB:\fP, \fBtrue\fP, \fBfalse\fP, and \fBtest\fP builtins +do not accept options. .sp .5 .PD 0 .TP @@ -5872,8 +5966,8 @@ is supplied, the name and value of the alias is printed. \fBAlias\fP returns true unless a \fIname\fP is given for which no alias has been defined. .TP -\fBbg\fP [\fIjobspec\fP] -Resume the suspended job \fIjobspec\fP in the background, as if it +\fBbg\fP [\fIjobspec\fP ...] +Resume each suspended job \fIjobspec\fP in the background, as if it had been started with .BR & . If \fIjobspec\fP is not present, the shell's notion of the @@ -5881,8 +5975,8 @@ If \fIjobspec\fP is not present, the shell's notion of the .B bg .I jobspec returns 0 unless run when job control is disabled or, when run with -job control enabled, if \fIjobspec\fP was not found or started without -job control. +job control enabled, any specified \fIjobspec\fP was not found +or was started without job control. .TP \fBbind\fP [\fB\-m\fP \fIkeymap\fP] [\fB\-lpsvPSV\fP] .PD 0 @@ -6174,6 +6268,11 @@ suppressing trailing spaces). Intended to be used with shell functions. .B nospace Tell readline not to append a space (the default) to words completed at the end of the line. +.TP 8 +.B plusdirs +After any matches defined by the compspec are generated, +directory name completion is attempted and any +matches are added to the results of the other actions. .RE .TP 8 \fB\-A\fP \fIaction\fP @@ -6376,7 +6475,8 @@ by subsequent assignment statements or unset. .TP .B \-t Give each \fIname\fP the \fItrace\fP attribute. -Traced functions inherit the \fBDEBUG\fP trap from the calling shell. +Traced functions inherit the \fBDEBUG\fP and \fBRETURN\fP traps from +the calling shell. The trace attribute has no special meaning for variables. .TP .B \-x @@ -6495,9 +6595,7 @@ The \fBxpg_echo\fP shell option may be used to dynamically determine whether or not \fBecho\fP expands these escape characters by default. .B echo -does not interpret -.B \-\- -to mean the end of options. +does not interpret \fB\-\-\fP to mean the end of options. .B echo interprets the following escape sequences: .RS @@ -7205,7 +7303,7 @@ is empty, a non-existent directory stack entry is specified, or the directory change fails. .RE .TP -\fBprintf\fP \fIformat\fP [\fIarguments\fP] +\fBprintf\fP [\fB\-v\fP \fIvar\fP] \fIformat\fP [\fIarguments\fP] Write the formatted \fIarguments\fP to the standard output under the control of the \fIformat\fP. The \fIformat\fP is a character string which contains three types of objects: @@ -7221,6 +7319,9 @@ beginning with \fB\e0\fP may contain up to four digits), and \fB%q\fP causes \fBprintf\fP to output the corresponding \fIargument\fP in a format that can be reused as shell input. .sp 1 +The \fB\-v\fP option causes the output to be assigned to the variable +\fIvar\fP rather than being printed to the standard output. +.sp 1 The \fIformat\fP is reused as necessary to consume all of the \fIarguments\fP. If the \fIformat\fP requires more \fIarguments\fP than are supplied, the extra format specifications behave as if a zero value or null string, as @@ -7366,7 +7467,7 @@ input is not read within \fItimeout\fP seconds. This option has no effect if \fBread\fP is not reading input from the terminal or a pipe. .TP -.B \-u \fIfd\FP +.B \-u \fIfd\fP Read input from file descriptor \fIfd\fP. .PD .PP @@ -7435,7 +7536,10 @@ before execution resumes after the function or script. .TP \fBset\fP [\fB\-\-abefhkmnptuvxBCHP\fP] [\fB\-o\fP \fIoption\fP] [\fIarg\fP ...] Without options, the name and value of each shell variable are displayed -in a format that can be reused as input. +in a format that can be reused as input +for setting or resetting the currently-set variables. +Read-only variables cannot be reset. +In \fIposix mode\fP, only shell variables are listed. The output is sorted according to the current locale. When options are specified, they set or unset shell attributes. Any arguments remaining after the options are processed are treated @@ -7608,7 +7712,7 @@ This option is disabled by default. Change the behavior of .B bash where the default operation differs -from the POSIX 1003.2 standard to match the standard (\fI`posix mode\fP). +from the POSIX 1003.2 standard to match the standard (\fIposix mode\fP). .TP 8 .B privileged Same as @@ -7722,9 +7826,11 @@ follows the logical chain of directories when performing commands which change the current directory. .TP 8 .B \-T -If set, any trap on \fBDEBUG\fP is inherited by shell functions, command -substitutions, and commands executed in a subshell environment. -The \fBDEBUG\fP trap is normally not inherited in such cases. +If set, any traps on \fBDEBUG\fP and \fBRETURN\fP are inherited by shell +functions, command substitutions, and commands executed in a +subshell environment. +The \fBDEBUG\fP and \fBRETURN\fP traps are normally not inherited +in such cases. .TP 8 .B \-\- If no arguments follow this option, then the positional parameters are @@ -7904,6 +8010,20 @@ If the command run by the \fBDEBUG\fP trap returns a value of 2, and the shell is executing in a subroutine (a shell function or a shell script executed by the \fB.\fP or \fBsource\fP builtins), a call to \fBreturn\fP is simulated. +.TP +.B 4. +\fBBASH_ARGC\fP and \fBBASH_ARGV\fP are updated as described in their +descriptions above. +.TP +.B 5. +Function tracing is enabled: command substitution, shell functions, and +subshells invoked with \fB(\fP \fIcommand\fP \fB)\fP inherit the +\fBDEBUG\fP and \fBRETURN\fP traps. +.TP +.B 6. +Error tracing is enabled: command substitution, shell functions, and +subshells invoked with \fB(\fP \fIcommand\fP \fB)\fP inherit the +\fBERROR\fP trap. .RE .TP 8 .B extglob @@ -8013,6 +8133,12 @@ expansion (see .B Pathname Expansion above). .TP 8 +.B nocasematch +If set, +.B bash +matches patterns in a case\-insensitive fashion when performing matching +while executing \fBcase\fP or \fB[[\fP conditional commands. +.TP 8 .B nullglob If set, .B bash @@ -8086,6 +8212,8 @@ Each operator and operand must be a separate argument. Expressions are composed of the primaries described above under .SM .BR "CONDITIONAL EXPRESSIONS" . +\fBtest\fP does not accept any options, nor does it accept and ignore +an argument of \fB\-\-\fP as signifying the end of options. .if t .sp 0.5 .if n .sp 1 Expressions may be combined using the following operators, listed @@ -8232,7 +8360,7 @@ command, and before the first command executes in a shell function (see .SM .B SHELL GRAMMAR above). -Refer to the description of the \fBextglob\fP option to the +Refer to the description of the \fBextdebug\fP option to the \fBshopt\fP builtin for details of its effect on the \fBDEBUG\fP trap. If a .I sigspec @@ -8487,8 +8615,7 @@ refers to a shell variable. Read-only variables may not be unset. If .B \-f -is specifed, -each +is specified, each .I name refers to a shell function, and the function definition is removed. @@ -8515,9 +8642,9 @@ subsequently reset. The exit status is true unless a .I name is readonly. .TP -\fBwait\fP [\fIn\fP] -Wait for the specified process and return its termination -status. +\fBwait\fP [\fIn ...\fP] +Wait for each specified process and return its termination status. +Each .I n may be a process ID or a job specification; if a job spec is given, all processes @@ -8661,7 +8788,7 @@ bfox@gnu.org .PP Chet Ramey, Case Western Reserve University .br -chet@po.CWRU.Edu +chet@po.cwru.edu .SH BUG REPORTS If you find a bug in .B bash, @@ -8702,7 +8829,7 @@ it provides for filing a bug report. .PP Comments and bug reports concerning this manual page should be directed to -.IR chet@po.CWRU.Edu . +.IR chet@po.cwru.edu . .SH BUGS .PP It's too big and too slow. diff --git a/doc/bashref.info b/doc/bashref.info index 650361b..ce029be 100644 --- a/doc/bashref.info +++ b/doc/bashref.info @@ -2,12 +2,12 @@ This is bashref.info, produced by makeinfo version 4.7 from /Users/chet/src/bash/src/doc/bashref.texi. This text is a brief description of the features that are present in -the Bash shell (version 3.0, 27 July 2004). +the Bash shell (version 3.1-beta1, 5 September 2005). - This is Edition 3.0, last updated 27 July 2004, of `The GNU Bash -Reference Manual', for `Bash', Version 3.0. + This is Edition 3.1-beta1, last updated 5 September 2005, of `The +GNU Bash Reference Manual', for `Bash', Version 3.1-beta1. - Copyright (C) 1988-2004 Free Software Foundation, Inc. + Copyright (C) 1988-2005 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are @@ -37,10 +37,10 @@ Bash Features ************* This text is a brief description of the features that are present in -the Bash shell (version 3.0, 27 July 2004).. +the Bash shell (version 3.1-beta1, 5 September 2005).. - This is Edition 3.0, last updated 27 July 2004, of `The GNU Bash -Reference Manual', for `Bash', Version 3.0. + This is Edition 3.1-beta1, last updated 5 September 2005, of `The +GNU Bash Reference Manual', for `Bash', Version 3.1-beta1. Bash contains features that appear in other popular shells, and some features that only appear in Bash. Some of the shells that Bash has @@ -56,46 +56,28 @@ on shell behavior. * Menu: * Introduction:: An introduction to the shell. - * Definitions:: Some definitions used in the rest of this manual. - * Basic Shell Features:: The shell "building blocks". - * Shell Builtin Commands:: Commands that are a part of the shell. - * Shell Variables:: Variables used or set by Bash. - * Bash Features:: Features found only in Bash. - -* Job Control:: A chapter describing what job control is - and how Bash allows you to use it. - -* Using History Interactively:: Chapter dealing with history expansion - rules. - +* Job Control:: What job control is and how Bash allows you + to use it. +* Using History Interactively:: Command History Expansion * Command Line Editing:: Chapter describing the command line editing features. - * Installing Bash:: How to build and install Bash on your system. - * Reporting Bugs:: How to report bugs in Bash. - * Major Differences From The Bourne Shell:: A terse list of the differences between Bash and historical versions of /bin/sh. - * Copying This Manual:: Copying this manual. - * Builtin Index:: Index of Bash builtin commands. - * Reserved Word Index:: Index of Bash reserved words. - * Variable Index:: Quick reference helps you find the variable you want. - * Function Index:: Index of bindable Readline functions. - * Concept Index:: General index for concepts described in this manual. @@ -108,7 +90,6 @@ File: bashref.info, Node: Introduction, Next: Definitions, Prev: Top, Up: To * Menu: * What is Bash?:: A short description of Bash. - * What is a shell?:: A brief introduction to shells. @@ -313,9 +294,7 @@ File: bashref.info, Node: Shell Syntax, Next: Shell Commands, Up: Basic Shell * Menu: * Shell Operation:: The basic operation of the shell. - * Quoting:: How to remove the special meaning from characters. - * Comments:: How to specify comments. When the shell reads input, it proceeds through a sequence of @@ -382,7 +361,6 @@ File: bashref.info, Node: Quoting, Next: Comments, Prev: Shell Operation, Up * Double Quotes:: How to suppress most of the interpretation of a sequence of characters. * ANSI-C Quoting:: How to expand ANSI-C sequences in quoted strings. - * Locale Translation:: How to translate strings into different languages. Quoting is used to remove the special meaning of certain characters @@ -392,10 +370,10 @@ recognized as such, and to prevent parameter expansion. Each of the shell metacharacters (*note Definitions::) has special meaning to the shell and must be quoted if it is to represent itself. -When the command history expansion facilities are being used, the -HISTORY EXPANSION character, usually `!', must be quoted to prevent -history expansion. *Note Bash History Facilities::, for more details -concerning history expansion. +When the command history expansion facilities are being used (*note +History Interaction::), the HISTORY EXPANSION character, usually `!', +must be quoted to prevent history expansion. *Note Bash History +Facilities::, for more details concerning history expansion. There are three quoting mechanisms: the ESCAPE CHARACTER, single quotes, and double quotes. @@ -431,15 +409,17 @@ File: bashref.info, Node: Double Quotes, Next: ANSI-C Quoting, Prev: Single Q Enclosing characters in double quotes (`"') preserves the literal value of all characters within the quotes, with the exception of `$', ``', -and `\'. The characters `$' and ``' retain their special meaning -within double quotes (*note Shell Expansions::). The backslash retains -its special meaning only when followed by one of the following -characters: `$', ``', `"', `\', or `newline'. Within double quotes, -backslashes that are followed by one of these characters are removed. -Backslashes preceding characters without a special meaning are left -unmodified. A double quote may be quoted within double quotes by -preceding it with a backslash. When command history is being used, the -double quote may not be used to quote the history expansion character. +`\', and, when history expansion is enabled, `!'. The characters `$' +and ``' retain their special meaning within double quotes (*note Shell +Expansions::). The backslash retains its special meaning only when +followed by one of the following characters: `$', ``', `"', `\', or +`newline'. Within double quotes, backslashes that are followed by one +of these characters are removed. Backslashes preceding characters +without a special meaning are left unmodified. A double quote may be +quoted within double quotes by preceding it with a backslash. If +enabled, history expansion will be performed unless an `!' appearing in +double quotes is escaped using a backslash. The backslash preceding +the `!' is not removed. The special parameters `*' and `@' have special meaning when in double quotes (*note Shell Parameter Expansion::). @@ -768,7 +748,10 @@ File: bashref.info, Node: Conditional Constructs, Next: Command Grouping, Pre `case WORD in [ [(] PATTERN [| PATTERN]...) COMMAND-LIST ;;]... esac' `case' will selectively execute the COMMAND-LIST corresponding to - the first PATTERN that matches WORD. The `|' is used to separate + the first PATTERN that matches WORD. If the shell option + `nocasematch' (see the description of `shopt' in *Note Bash + Builtins::) is enabled, the match is performed without regard to + the case of alphabetic characters. The `|' is used to separate multiple patterns, and the `)' operator terminates a pattern list. A list of patterns and an associated command-list is known as a CLAUSE. Each clause must be terminated with `;;'. The WORD @@ -854,8 +837,11 @@ File: bashref.info, Node: Conditional Constructs, Next: Command Grouping, Pre When the `==' and `!=' operators are used, the string to the right of the operator is considered a pattern and matched according to - the rules described below in *Note Pattern Matching::. The return - value is 0 if the string matches or does not match the pattern, + the rules described below in *Note Pattern Matching::. If the + shell option `nocasematch' (see the description of `shopt' in + *Note Bash Builtins::) is enabled, the match is performed without + regard to the case of alphabetic characters. The return value is + 0 if the string matches or does not match the pattern, respectively, and 1 otherwise. Any part of the pattern may be quoted to force it to be matched as a string. @@ -865,7 +851,7 @@ File: bashref.info, Node: Conditional Constructs, Next: Command Grouping, Pre and matched accordingly (as in regex3)). The return value is 0 if the string matches the pattern, and 1 otherwise. If the regular expression is syntactically incorrect, the conditional - expression's return value is 2. If the shell option `nocaseglob' + expression's return value is 2. If the shell option `nocasematch' (see the description of `shopt' in *Note Bash Builtins::) is enabled, the match is performed without regard to the case of alphabetic characters. Substrings matched by parenthesized @@ -978,11 +964,11 @@ parameter `0' is unchanged. The first element of the `FUNCNAME' variable is set to the name of the function while the function is executing. All other aspects of the shell execution environment are identical between a function and its caller with the exception that the -`DEBUG' trap below) is not inherited unless the function has been given -the `trace' attribute using the `declare' builtin or the `-o functrace' -option has been enabled with the `set' builtin, (in which case all -functions inherit the `DEBUG' trap). *Note Bourne Shell Builtins::, -for the description of the `trap' builtin. +`DEBUG' and `RETURN' traps are not inherited unless the function has +been given the `trace' attribute using the `declare' builtin or the `-o +functrace' option has been enabled with the `set' builtin, (in which +case all functions inherit the `DEBUG' and `RETURN' traps). *Note +Bourne Shell Builtins::, for the description of the `trap' builtin. If the builtin command `return' is executed in a function, the function completes and execution resumes with the next command after @@ -1046,6 +1032,18 @@ expansion is not performed. Assignment statements may also appear as arguments to the `alias', `declare', `typeset', `export', `readonly', and `local' builtin commands. + In the context where an assignment statement is assigning a value to +a shell variable or array index (*note Arrays::), the `+=' operator can +be used to append to or add to the variable's previous value. When +`+=' is applied to a variable for which the integer attribute has been +set, VALUE is evaluated as an arithmetic expression and added to the +variable's current value, which is also evaluated. When `+=' is +applied to an array variable using compound assignment (*note +Arrays::), the variable's value is not unset (as it is when using `='), +and new values are appended to the array beginning at one greater than +the array's maximum index. When applied to a string-valued variable, +VALUE is expanded and appended to the variable's value. + File: bashref.info, Node: Positional Parameters, Next: Special Parameters, Up: Shell Parameters @@ -1088,8 +1086,12 @@ only be referenced; assignment to them is not allowed. Expands to the positional parameters, starting from one. When the expansion occurs within double quotes, each parameter expands to a separate word. That is, `"$@"' is equivalent to `"$1" "$2" ...'. - When there are no positional parameters, `"$@"' and `$@' expand to - nothing (i.e., they are removed). + If the double-quoted expansion occurs within a word, the expansion + of the first parameter is joined with the beginning part of the + original word, and the expansion of the last parameter is joined + with the last part of the original word. When there are no + positional parameters, `"$@"' and `$@' expand to nothing (i.e., + they are removed). `#' Expands to the number of positional parameters in decimal. @@ -1121,13 +1123,13 @@ only be referenced; assignment to them is not allowed. invoke Bash, as given by argument zero. `_' - (An underscore.) At shell startup, set to the absolute filename - of the shell or shell script being executed as passed in the - argument list. Subsequently, expands to the last argument to the - previous command, after expansion. Also set to the full pathname - of each command executed and placed in the environment exported to - that command. When checking mail, this parameter holds the name - of the mail file. + (An underscore.) At shell startup, set to the absolute pathname + used to invoke the shell or shell script being executed as passed + in the environment or argument list. Subsequently, expands to the + last argument to the previous command, after expansion. Also set + to the full pathname used to invoke each command executed and + placed in the environment exported to that command. When checking + mail, this parameter holds the name of the mail file. File: bashref.info, Node: Shell Expansions, Next: Redirections, Prev: Shell Parameters, Up: Basic Shell Features @@ -1267,10 +1269,10 @@ without a leading `+' or `-', `+' is assumed. is left unchanged. Each variable assignment is checked for unquoted tilde-prefixes -immediately following a `:' or `='. In these cases, tilde expansion is -also performed. Consequently, one may use file names with tildes in -assignments to `PATH', `MAILPATH', and `CDPATH', and the shell assigns -the expanded value. +immediately following a `:' or the first `='. In these cases, tilde +expansion is also performed. Consequently, one may use file names with +tildes in assignments to `PATH', `MAILPATH', and `CDPATH', and the +shell assigns the expanded value. The following table shows how Bash treats unquoted tilde-prefixes: @@ -1375,9 +1377,12 @@ if the colon is omitted, the operator tests only for existence. is `@', the result is LENGTH positional parameters beginning at OFFSET. If PARAMETER is an array name indexed by `@' or `*', the result is the LENGTH members of the array beginning with - `${PARAMETER[OFFSET]}'. Substring indexing is zero-based unless - the positional parameters are used, in which case the indexing - starts at 1. + `${PARAMETER[OFFSET]}'. A negative OFFSET is taken relative to + one greater than the maximum index of the specified array. Note + that a negative offset must be separated from the colon by at least + one space to avoid being confused with the `:-' expansion. + Substring indexing is zero-based unless the positional parameters + are used, in which case the indexing starts at 1. `${!PREFIX*}' `${!PREFIX@}' @@ -1671,7 +1676,7 @@ of the following sub-patterns: Matches one or more occurrences of the given patterns. `@(PATTERN-LIST)' - Matches exactly one of the given patterns. + Matches one of the given patterns. `!(PATTERN-LIST)' Matches anything except one of the given patterns. @@ -1749,6 +1754,10 @@ redirections, as described in the following table: A failure to open or create a file causes the redirection to fail. + Redirections using file descriptors greater than 9 should be used +with care, as they may conflict with file descriptors the shell uses +internally. + 3.6.1 Redirecting Input ----------------------- @@ -1895,18 +1904,13 @@ File: bashref.info, Node: Executing Commands, Next: Shell Scripts, Prev: Redi * Simple Command Expansion:: How Bash expands simple commands before executing them. - * Command Search and Execution:: How Bash finds commands and runs them. - * Command Execution Environment:: The environment in which Bash executes commands that are not shell builtins. - * Environment:: The environment given to a command. - * Exit Status:: The status returned by commands and how Bash interprets it. - * Signals:: What happens when Bash or a command it runs receives a signal. @@ -2264,6 +2268,8 @@ Completion Builtins::). Unless otherwise noted, each builtin command documented as accepting options preceded by `-' accepts `--' to signify the end of the options. +For example, the `:', `true', `false', and `test' builtins do not +accept options. File: bashref.info, Node: Bourne Shell Builtins, Next: Bash Builtins, Up: Shell Builtin Commands @@ -2480,6 +2486,8 @@ standard. Evaluate a conditional expression EXPR. Each operator and operand must be a separate argument. Expressions are composed of the primaries described below in *Note Bash Conditional Expressions::. + `test' does not accept any options, nor does it accept and ignore + an argument of `--' as signifying the end of options. When the `[' form is used, the last argument to the command must be a `]'. @@ -2780,8 +2788,8 @@ POSIX 1003.2 standard. `-t' Give each NAME the `trace' attribute. Traced functions - inherit the `DEBUG' trap from the calling shell. The trace - attribute has no special meaning for variables. + inherit the `DEBUG' and `RETURN' traps from the calling shell. + The trace attribute has no special meaning for variables. `-x' Mark each NAME for export to subsequent commands via the @@ -2812,7 +2820,10 @@ POSIX 1003.2 standard. escape characters, even on systems where they are interpreted by default. The `xpg_echo' shell option may be used to dynamically determine whether or not `echo' expands these escape characters by - default. `echo' interprets the following escape sequences: + default. `echo' does not interpret `--' to mean the end of + options. + + `echo' interprets the following escape sequences: `\a' alert (bell) @@ -2914,7 +2925,7 @@ POSIX 1003.2 standard. Exit a login shell, returning a status of N to the shell's parent. `printf' - `printf' FORMAT [ARGUMENTS] + `printf' [-v VAR] FORMAT [ARGUMENTS] Write the formatted ARGUMENTS to the standard output under the control of the FORMAT. The FORMAT is a character string which contains three types of objects: plain characters, which are @@ -2929,6 +2940,9 @@ POSIX 1003.2 standard. and `%q' causes `printf' to output the corresponding ARGUMENT in a format that can be reused as shell input. + The `-v' option causes the output to be assigned to the variable + VAR rather than being printed to the standard output. + The FORMAT is reused as necessary to consume all of the ARGUMENTS. If the FORMAT requires more ARGUMENTS than are supplied, the extra format specifications behave as if a zero value or null string, as @@ -3092,6 +3106,17 @@ POSIX 1003.2 standard. shell function or a shell script executed by the `.' or `source' builtins), a call to `return' is simulated. + 4. `BASH_ARGC' and `BASH_ARGV' are updated as described in + their descriptions (*note Bash Variables::). + + 5. Function tracing is enabled: command substitution, + shell functions, and subshells invoked with `( COMMAND + )' inherit the `DEBUG' and `RETURN' traps. + + 6. Error tracing is enabled: command substitution, shell + functions, and subshells invoked with `( COMMAND )' + inherit the `ERROR' trap. + `extglob' If set, the extended pattern matching features described above (*note Pattern Matching::) are enabled. @@ -3169,6 +3194,11 @@ POSIX 1003.2 standard. If set, Bash matches filenames in a case-insensitive fashion when performing filename expansion. + `nocasematch' + If set, Bash matches patterns in a case-insensitive fashion + when performing matching while executing `case' or `[[' + conditional commands. + `nullglob' If set, Bash allows filename patterns which match no files to expand to a null string, rather than themselves. @@ -3334,7 +3364,10 @@ This builtin is so complicated that it deserves its own section. If no options or arguments are supplied, `set' displays the names and values of all shell variables and functions, sorted according - to the current locale, in a format that may be reused as input. + to the current locale, in a format that may be reused as input for + setting or resetting the currently-set variables. Read-only + variables cannot be reset. In POSIX mode, only shell variables + are listed. When options are supplied, they set or unset shell attributes. Options, if specified, have the following meanings: @@ -3540,10 +3573,10 @@ This builtin is so complicated that it deserves its own section. /usr/local `-T' - If set, any trap on `DEBUG' is inherited by shell functions, - command substitutions, and commands executed in a subshell - environment. The `DEBUG' trap is normally not inherited in - such cases. + If set, any trap on `DEBUG' and `RETURN' are inherited by + shell functions, command substitutions, and commands executed + in a subshell environment. The `DEBUG' and `RETURN' traps + are normally not inherited in such cases. `--' If no arguments follow this option, then the positional @@ -3690,14 +3723,19 @@ Variables::). parameters to the current subroutine (shell function or script executed with `.' or `source') is at the top of the stack. When a subroutine is executed, the number of parameters passed is pushed - onto `BASH_ARGC'. + onto `BASH_ARGC'. The shell sets `BASH_ARGC' only when in + extended debugging mode (see *Note Bash Builtins:: for a + description of the `extdebug' option to the `shopt' builtin). `BASH_ARGV' An array variable containing all of the parameters in the current bash execution call stack. The final parameter of the last subroutine call is at the top of the stack; the first parameter of the initial call is at the bottom. When a subroutine is executed, - the parameters supplied are pushed onto `BASH_ARGV'. + the parameters supplied are pushed onto `BASH_ARGV'. The shell + sets `BASH_ARGV' only when in extended debugging mode (see *Note + Bash Builtins:: for a description of the `extdebug' option to the + `shopt' builtin). `BASH_COMMAND' The command currently being executed or about to be executed, @@ -3717,9 +3755,9 @@ Variables::). An array variable whose members are the line numbers in source files corresponding to each member of FUNCNAME. `${BASH_LINENO[$i]}' is the line number in the source file where - `${FUNCNAME[$i + 1]}' was called. The corresponding source file - name is `${BASH_SOURCE[$i + 1]}'. Use `LINENO' to obtain the - current line number. + `${FUNCNAME[$i]}' was called. The corresponding source file name + is `${BASH_SOURCE[$i]}'. Use `LINENO' to obtain the current line + number. `BASH_REMATCH' An array variable whose members are assigned by the `=~' binary @@ -4141,6 +4179,10 @@ Variables::). the shell is interactive. Bash terminates after that number of seconds if input does not arrive. +`TMPDIR' + If set, Bash uses its value as the name of a directory in which + Bash creates temporary files for the shell's use. + `UID' The numeric real user id of the current user. This variable is readonly. @@ -4195,7 +4237,7 @@ the single-character options to be recognized. `--dump-po-strings' A list of all double-quoted strings preceded by `$' is printed on - the standard ouput in the GNU `gettext' PO (portable object) file + the standard output in the GNU `gettext' PO (portable object) file format. Equivalent to `-D' except for the output format. `--dump-strings' @@ -4276,7 +4318,7 @@ invocation which are not available with the `set' builtin. `-D' A list of all double-quoted strings preceded by `$' is printed on - the standard ouput. These are the strings that are subject to + the standard output. These are the strings that are subject to language translation when the current locale is not `C' or `POSIX' (*note Locale Translation::). This implies the `-n' option; no commands will be executed. @@ -4577,6 +4619,10 @@ checked. If the FILE argument to one of the primaries is one of `/dev/stdin', `/dev/stdout', or `/dev/stderr', file descriptor 0, 1, or 2, respectively, is checked. + Unless otherwise specified, primaries that operate on files follow +symbolic links and operate on the target of the link, rather than the +link itself. + `-a FILE' True if FILE exists. @@ -4775,7 +4821,7 @@ representing the arithmetic base, and N is a number in that base. If BASE`#' is omitted, then base 10 is used. The digits greater than 9 are represented by the lowercase letters, the uppercase letters, `@', and `_', in that order. If BASE is less than or equal to 36, lowercase -and uppercase letters may be used interchangably to represent numbers +and uppercase letters may be used interchangeably to represent numbers between 10 and 35. Operators are evaluated in order of precedence. Sub-expressions in @@ -4878,16 +4924,21 @@ the word is double-quoted, `${name[*]}' expands to a single word with the value of each array member separated by the first character of the `IFS' variable, and `${name[@]}' expands each element of NAME to a separate word. When there are no array members, `${name[@]}' expands -to nothing. This is analogous to the expansion of the special -parameters `@' and `*'. `${#name['SUBSCRIPT`]}' expands to the length -of `${name['SUBSCRIPT`]}'. If SUBSCRIPT is `@' or `*', the expansion -is the number of elements in the array. Referencing an array variable -without a subscript is equivalent to referencing element zero. +to nothing. If the double-quoted expansion occurs within a word, the +expansion of the first parameter is joined with the beginning part of +the original word, and the expansion of the last parameter is joined +with the last part of the original word. This is analogous to the +expansion of the special parameters `@' and `*'. +`${#name['SUBSCRIPT`]}' expands to the length of `${name['SUBSCRIPT`]}'. +If SUBSCRIPT is `@' or `*', the expansion is the number of elements in +the array. Referencing an array variable without a subscript is +equivalent to referencing element zero. The `unset' builtin is used to destroy arrays. `unset' -NAME[SUBSCRIPT] destroys the array element at index SUBSCRIPT. `unset' -NAME, where NAME is an array, removes the entire array. A subscript of -`*' or `@' also removes the entire array. +NAME[SUBSCRIPT] destroys the array element at index SUBSCRIPT. Care +must be taken to avoid unwanted side effects caused by filename +generation. `unset' NAME, where NAME is an array, removes the entire +array. A subscript of `*' or `@' also removes the entire array. The `declare', `local', and `readonly' builtins each accept a `-a' option to specify an array. The `read' builtin accepts a `-a' option @@ -5190,58 +5241,59 @@ startup files. is stopped is `Stopped(SIGNAME)', where SIGNAME is, for example, `SIGTSTP'. - 4. Reserved words may not be aliased. + 4. The `bg' builtin uses the required format to describe each job + placed in the background, which does not include an indication of + whether the job is the current or previous job. + + 5. Reserved words appearing in a context where reserved words are + recognized do not undergo alias expansion. - 5. The POSIX 1003.2 `PS1' and `PS2' expansions of `!' to the history + 6. The POSIX 1003.2 `PS1' and `PS2' expansions of `!' to the history number and `!!' to `!' are enabled, and parameter expansion is performed on the values of `PS1' and `PS2' regardless of the setting of the `promptvars' option. - 6. The POSIX 1003.2 startup files are executed (`$ENV') rather than + 7. The POSIX 1003.2 startup files are executed (`$ENV') rather than the normal Bash files. - 7. Tilde expansion is only performed on assignments preceding a + 8. Tilde expansion is only performed on assignments preceding a command name, rather than on all assignment statements on the line. - 8. The default history file is `~/.sh_history' (this is the default + 9. The default history file is `~/.sh_history' (this is the default value of `$HISTFILE'). - 9. The output of `kill -l' prints all the signal names on a single + 10. The output of `kill -l' prints all the signal names on a single line, separated by spaces, without the `SIG' prefix. - 10. The `kill' builtin does not accept signal names with a `SIG' + 11. The `kill' builtin does not accept signal names with a `SIG' prefix. - 11. Non-interactive shells exit if FILENAME in `.' FILENAME is not + 12. Non-interactive shells exit if FILENAME in `.' FILENAME is not found. - 12. Non-interactive shells exit if a syntax error in an arithmetic + 13. Non-interactive shells exit if a syntax error in an arithmetic expansion results in an invalid expression. - 13. Redirection operators do not perform filename expansion on the word + 14. Redirection operators do not perform filename expansion on the word in the redirection unless the shell is interactive. - 14. Redirection operators do not perform word splitting on the word in + 15. Redirection operators do not perform word splitting on the word in the redirection. - 15. Function names must be valid shell `name's. That is, they may not + 16. Function names must be valid shell `name's. That is, they may not contain characters other than letters, digits, and underscores, and may not start with a digit. Declaring a function with an invalid name causes a fatal syntax error in non-interactive shells. - 16. POSIX 1003.2 `special' builtins are found before shell functions + 17. POSIX 1003.2 special builtins are found before shell functions during command lookup. - 17. If a POSIX 1003.2 special builtin returns an error status, a + 18. If a POSIX 1003.2 special builtin returns an error status, a non-interactive shell exits. The fatal errors are those listed in 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. - 18. If the `cd' builtin finds a directory to change to using - `$CDPATH', the value it assigns to the `PWD' variable does not - contain any symbolic links, as if `cd -P' had been executed. - 19. If `CDPATH' is set, the `cd' builtin will not implicitly append the current directory to it. This means that `cd' will fail if no valid directory name can be constructed from any of the entries in @@ -5273,9 +5325,10 @@ startup files. 27. The `trap' builtin doesn't check the first argument for a possible signal specification and revert the signal handling to the original - disposition if it is. If users want to reset the handler for a - given signal to the original disposition, they should use `-' as - the first argument. + disposition if it is, unless that argument consists solely of + digits and is a valid signal number. If users want to reset the + handler for a given signal to the original disposition, they + should use `-' as the first argument. 28. The `.' and `source' builtins do not search the current directory for the filename argument if it is not found by searching `PATH'. @@ -5302,21 +5355,46 @@ startup files. argument does not refer to an existing directory, `cd' will fail instead of falling back to PHYSICAL mode. - There is other POSIX 1003.2 behavior that Bash does not implement. -Specifically: + 35. When the `pwd' builtin is supplied the `-P' option, it resets + `$PWD' to a pathname containing no symlinks. + + 36. The `pwd' builtin verifies that the value it prints is the same as + the current directory, even if it is not asked to check the file + system with the `-P' option. + + 37. When listing the history, the `fc' builtin does not include an + indication of whether or not a history entry has been modified. + + 38. The default editor used by `fc' is `ed'. + + 39. The `type' and `command' builtins will not report a non-executable + file as having been found, though the shell will attempt to + execute such a file if it is the only so-named file found in + `$PATH'. - 1. Assignment statements affect the execution environment of all - builtins, not just special ones. + 40. The `vi' editing mode will invoke the `vi' editor directly when + the `v' command is run, instead of checking `$FCEDIT' and + `$EDITOR'. - 2. When a subshell is created to execute a shell script with execute - permission, but without a leading `#!', Bash sets `$0' to the full - pathname of the script as found by searching `$PATH', rather than - the command as typed by the user. + 41. When the `xpg_echo' option is enabled, Bash does not attempt to + interpret any arguments to `echo' as options. Each argument is + displayed, after escape characters are converted. - 3. When using `.' to source a shell script found in `$PATH', bash - checks execute permission bits rather than read permission bits, - just as if it were searching for a command. + There is other POSIX 1003.2 behavior that Bash does not implement by +default even when in POSIX mode. Specifically: + + 1. The `fc' builtin checks `$EDITOR' as a program to edit history + entries if `FCEDIT' is unset, rather than defaulting directly to + `ed'. `fc' uses `ed' if `EDITOR' is unset. + + 2. As noted above, Bash requires the `xpg_echo' option to be enabled + for the `echo' builtin to be fully conformant. + + + Bash can be configured to be POSIX-conformant by default, by +specifying the `--enable-strict-posix-default' to `configure' when +building (*note Optional Features::). File: bashref.info, Node: Job Control, Next: Using History Interactively, Prev: Bash Features, Up: Top @@ -5386,9 +5464,10 @@ character `%' introduces a job name. Job number `n' may be referred to as `%n'. The symbols `%%' and `%+' refer to the shell's notion of the current job, which is the last -job stopped while it was in the foreground or started in the -background. The previous job may be referenced using `%-'. In output -pertaining to jobs (e.g., the output of the `jobs' command), the +job stopped while it was in the foreground or started in the background. +A single `%' (with no accompanying job specification) also refers to +the current job. The previous job may be referenced using `%-'. In +output pertaining to jobs (e.g., the output of the `jobs' command), the current job is always flagged with a `+', and the previous job with a `-'. @@ -5424,13 +5503,13 @@ File: bashref.info, Node: Job Control Builtins, Next: Job Control Variables, ======================== `bg' - bg [JOBSPEC] - Resume the suspended job JOBSPEC in the background, as if it had + bg [JOBSPEC ...] + Resume each suspended job JOBSPEC in the background, as if it had been started with `&'. If JOBSPEC is not supplied, the current job is used. The return status is zero unless it is run when job - control is not enabled, or, when run with job control enabled, if - JOBSPEC was not found or JOBSPEC specifies a job that was started - without job control. + control is not enabled, or, when run with job control enabled, any + JOBSPEC was not found or specifies a job that was started without + job control. `fg' fg [JOBSPEC] @@ -5490,11 +5569,11 @@ File: bashref.info, Node: Job Control Builtins, Next: Job Control Variables, occurs or an invalid option is encountered. `wait' - wait [JOBSPEC or PID] - Wait until the child process specified by process ID PID or job - specification JOBSPEC exits and return the exit status of the last - command waited for. If a job spec is given, all processes in the - job are waited for. If no arguments are given, all currently + wait [JOBSPEC or PID ...] + Wait until the child process specified by each process ID PID or + job specification JOBSPEC exits and return the exit status of the + last command waited for. If a job spec is given, all processes in + the job are waited for. If no arguments are given, all currently active child processes are waited for, and the return status is zero. If neither JOBSPEC nor PID specifies an active child process of the shell, the return status is 127. @@ -5878,7 +5957,11 @@ Variable Settings set editing-mode vi Variable names and values, where appropriate, are recognized - without regard to case. + without regard to case. Unrecognized variable names are ignored. + + Boolean variables (those that can be set to on or off) are set to + on if the value is null or empty, ON (case-insensitive), or 1. + Any other value results in the variable being set to off. The `bind -V' command lists the current Readline variable names and values. *Note Bash Builtins::. @@ -5893,6 +5976,11 @@ Variable Settings one is available. If set to `audible' (the default), Readline attempts to ring the terminal's bell. + `bind-tty-special-chars' + If set to `on', Readline attempts to bind the control + characters treated specially by the kernel's terminal driver + to their Readline equivalents. + `comment-begin' The string to insert at the beginning of the line when the `insert-comment' command is executed. The default value is @@ -5910,7 +5998,8 @@ Variable Settings than this value, Readline will ask the user whether or not he wishes to view them; otherwise, they are simply listed. This variable must be set to an integer value greater than or - equal to 0. The default limit is `100'. + equal to 0. A negative value means Readline should never ask. + The default limit is `100'. `convert-meta' If set to `on', Readline will convert characters with the @@ -5938,9 +6027,10 @@ Variable Settings If set to `on', tilde expansion is performed when Readline attempts word completion. The default is `off'. + `history-preserve-point' If set to `on', the history code attempts to place point at the same location on each history line retrieved with - `previous-history' or `next-history'. + `previous-history' or `next-history'. The default is `off'. `horizontal-scroll-mode' This variable can be set to either `on' or `off'. Setting it @@ -6443,14 +6533,17 @@ File: bashref.info, Node: Commands For History, Next: Commands For Text, Prev second word on the previous line) at point. With an argument N, insert the Nth word from the previous command (the words in the previous command begin with word 0). A negative argument inserts - the Nth word from the end of the previous command. + the Nth word from the end of the previous command. Once the + argument N is computed, the argument is extracted as if the `!N' + history expansion had been specified. `yank-last-arg (M-. or M-_)' Insert last argument to the previous command (the last word of the previous history entry). With an argument, behave exactly like `yank-nth-arg'. Successive calls to `yank-last-arg' move back through the history list, inserting the last argument of each line - in turn. + in turn. The history expansion facilities are used to extract the + last argument, as if the `!$' history expansion had been specified. @@ -6911,12 +7004,11 @@ variable is used. considered. The string is first split using the characters in the `IFS' special variable as delimiters. Shell quoting is honored. Each word is then expanded using brace expansion, tilde expansion, parameter and -variable expansion, command substitution, arithmetic expansion, and -pathname expansion, as described above (*note Shell Expansions::). The -results are split using the rules described above (*note Word -Splitting::). The results of the expansion are prefix-matched against -the word being completed, and the matching words become the possible -completions. +variable expansion, command substitution, and arithmetic expansion, as +described above (*note Shell Expansions::). The results are split +using the rules described above (*note Word Splitting::). The results +of the expansion are prefix-matched against the word being completed, +and the matching words become the possible completions. After these matches have been generated, any shell function or command specified with the `-F' and `-C' options is invoked. When the @@ -7058,6 +7150,12 @@ completion facilities. Tell Readline not to append a space (the default) to words completed at the end of the line. + `plusdirs' + After any matches defined by the compspec are generated, + directory name completion is attempted and any matches + are added to the results of the other actions. + + `-A ACTION' The ACTION may be one of the following to generate a list of possible completions: @@ -7567,23 +7665,16 @@ MS-DOS, OS/2, and Windows platforms. * Menu: * Basic Installation:: Installation instructions. - * Compilers and Options:: How to set special options for various systems. - * Compiling For Multiple Architectures:: How to compile Bash for more than one kind of system from the same source tree. - * Installation Names:: How to set the various paths used by the installation. - * Specifying the System Type:: How to configure Bash for a particular system. - * Sharing Defaults:: How to share default configuration values among GNU programs. - * Operation Controls:: Options recognized by the configuration program. - * Optional Features:: How to enable and disable optional features when building Bash. @@ -7806,13 +7897,14 @@ that the Bash `configure' recognizes. Define if you are using the Andrew File System from Transarc. `--with-bash-malloc' - Use the Bash 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 some space on each allocation. 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. + Use the Bash version of `malloc' in the directory `lib/malloc'. + This is not the same `malloc' that appears in GNU libc, but an + older version originally derived from the 4.2 BSD `malloc'. This + `malloc' is very fast, but wastes some space on each allocation. + 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-curses' Use the curses library instead of the termcap library. This should @@ -7825,7 +7917,7 @@ that the Bash `configure' recognizes. `--with-installed-readline[=PREFIX]' Define this to make Bash link with a locally-installed version of Readline rather than the version in `lib/readline'. This works - only with Readline 4.3 and later versions. If PREFIX is `yes' or + only with Readline 5.0 and later versions. If PREFIX is `yes' or not supplied, `configure' uses the values of the make variables `includedir' and `libdir', which are subdirectories of `prefix' by default, to find the installed version of Readline if it is not in @@ -7906,6 +7998,9 @@ does not provide the necessary support. `=~' binary operator in the `[[' conditional command. (*note Conditional Constructs::). +`--enable-debugger' + Include support for the bash debugger (distributed separately). + `--enable-directory-stack' Include support for a `csh'-like directory stack and the `pushd', `popd', and `dirs' builtins (*note The Directory Stack::). @@ -7949,17 +8044,17 @@ does not provide the necessary support. This enables process substitution (*note Process Substitution::) if the operating system provides the necessary support. +`--enable-progcomp' + Enable the programmable completion facilities (*note Programmable + Completion::). If Readline is not enabled, this option has no + effect. + `--enable-prompt-string-decoding' Turn on the interpretation of a number of backslash-escaped characters in the `$PS1', `$PS2', `$PS3', and `$PS4' prompt strings. See *Note Printing a Prompt::, for a complete list of prompt string escape sequences. -`--enable-progcomp' - Enable the programmable completion facilities (*note Programmable - Completion::). If Readline is not enabled, this option has no - effect. - `--enable-readline' Include support for command-line editing and history with the Bash version of the Readline library (*note Command Line Editing::). @@ -7973,6 +8068,19 @@ does not provide the necessary support. Include the `select' builtin, which allows the generation of simple menus (*note Conditional Constructs::). +`--enable-separate-helpfiles' + Use external files for the documentation displayed by the `help' + builtin instead of storing the text internally. + +`--enable-single-help-strings' + Store the text displayed by the `help' builtin as a single string + for each help topic. This aids in translating the text to + different languages. You may need to disable this if your + compiler cannot handle very long string literals. + +`--enable-strict-posix-default' + Make Bash POSIX-conformant by default (*note Bash POSIX Mode::). + `--enable-usg-echo-default' A synonym for `--enable-xpg-echo-default'. @@ -7981,7 +8089,7 @@ does not provide the necessary support. default, without requiring the `-e' option. This sets the default value of the `xpg_echo' shell option to `on', which makes the Bash `echo' behave more like the version specified in the Single Unix - Specification, version 2. *Note Bash Builtins::, for a + Specification, version 3. *Note Bash Builtins::, for a description of the escape sequences that `echo' recognizes. @@ -8038,7 +8146,8 @@ be implemented. There are some differences between the traditional Bourne shell and Bash; this section quickly details the differences of significance. A number of these differences are explained in greater depth in previous sections. This section uses the version of `sh' -included in SVR4.2 as the baseline reference. +included in SVR4.2 (the last version of the historical Bourne shell) as +the baseline reference. * Bash is POSIX-conformant, even where the POSIX specification differs from traditional `sh' behavior (*note Bash POSIX Mode::). @@ -8078,7 +8187,9 @@ included in SVR4.2 as the baseline reference. * Bash implements the `!' keyword to negate the return value of a pipeline (*note Pipelines::). Very useful when an `if' statement - needs to act only if a test fails. + needs to act only if a test fails. The Bash `-o pipefail' option + to `set' will cause a pipeline to return a failure status if any + command fails. * Bash has the `time' reserved word and command timing (*note Pipelines::). The display of the timing statistics may be @@ -8092,7 +8203,11 @@ included in SVR4.2 as the baseline reference. generation of simple menus (*note Conditional Constructs::). * Bash includes the `[[' compound command, which makes conditional - testing part of the shell grammar (*note Conditional Constructs::). + testing part of the shell grammar (*note Conditional + Constructs::), including optional regular expression matching. + + * Bash provides optional case-insensitive matching for the `case' and + `[[' constructs. * Bash includes brace expansion (*note Brace Expansion::) and tilde expansion (*note Tilde Expansion::). @@ -8109,6 +8224,9 @@ included in SVR4.2 as the baseline reference. not normally do this unless the variables are explicitly marked using the `export' command. + * Bash supports the `+=' assignment operator, which appends to the + value of the variable named on the left hand side. + * Bash includes the POSIX pattern removal `%', `#', `%%' and `##' expansions to remove leading or trailing substrings from variable values (*note Shell Parameter Expansion::). @@ -8176,6 +8294,12 @@ included in SVR4.2 as the baseline reference. operator, for directing standard output and standard error to the same file (*note Redirections::). + * Bash includes the `<<<' redirection operator, allowing a string to + be used as the standard input to a command. + + * Bash implements the `[n]<&WORD' and `[n]>&WORD' redirection + operators, which move one file descriptor to another. + * Bash treats a number of filenames specially when they are used in redirection operators (*note Redirections::). @@ -8288,7 +8412,9 @@ included in SVR4.2 as the baseline reference. `DEBUG'. Commands specified with an `RETURN' trap are executed before execution resumes after a shell function or a shell script executed with `.' or `source' returns. The `RETURN' trap is not - inherited by shell functions. + inherited by shell functions unless the function has been given + the `trace' attribute or the `functrace' option has been enabled + using the `shopt' builtin. * The Bash `type' builtin is more extensive and gives more information about the names it finds (*note Bash Builtins::). @@ -8312,6 +8438,9 @@ included in SVR4.2 as the baseline reference. table (*note Job Control Builtins::) or suppress the sending of `SIGHUP' to a job when the shell exits as the result of a `SIGHUP'. + * Bash includes a number of features to support a separate debugger + for shell scripts. + * The SVR4.2 shell has two privilege-related builtins (`mldmode' and `priv') not present in Bash. @@ -8849,7 +8978,7 @@ Index of Shell Builtin Commands * disown: Job Control Builtins. (line 83) * echo: Bash Builtins. (line 191) -* enable: Bash Builtins. (line 244) +* enable: Bash Builtins. (line 247) * eval: Bourne Shell Builtins. (line 63) * exec: Bourne Shell Builtins. @@ -8866,24 +8995,24 @@ Index of Shell Builtin Commands (line 103) * hash: Bourne Shell Builtins. (line 145) -* help: Bash Builtins. (line 272) +* help: Bash Builtins. (line 275) * history: Bash History Builtins. (line 39) * jobs: Job Control Builtins. (line 25) * kill: Job Control Builtins. (line 57) -* let: Bash Builtins. (line 281) -* local: Bash Builtins. (line 288) -* logout: Bash Builtins. (line 298) +* let: Bash Builtins. (line 284) +* local: Bash Builtins. (line 291) +* logout: Bash Builtins. (line 301) * popd: Directory Stack Builtins. (line 37) -* printf: Bash Builtins. (line 302) +* printf: Bash Builtins. (line 305) * pushd: Directory Stack Builtins. (line 58) * pwd: Bourne Shell Builtins. (line 163) -* read: Bash Builtins. (line 324) +* read: Bash Builtins. (line 330) * readonly: Bourne Shell Builtins. (line 172) * return: Bourne Shell Builtins. @@ -8891,24 +9020,24 @@ Index of Shell Builtin Commands * set: The Set Builtin. (line 9) * shift: Bourne Shell Builtins. (line 200) -* shopt: Bash Builtins. (line 385) -* source: Bash Builtins. (line 600) +* shopt: Bash Builtins. (line 391) +* source: Bash Builtins. (line 622) * suspend: Job Control Builtins. (line 94) * test: Bourne Shell Builtins. (line 212) * times: Bourne Shell Builtins. - (line 276) + (line 278) * trap: Bourne Shell Builtins. - (line 281) -* type: Bash Builtins. (line 604) -* typeset: Bash Builtins. (line 635) -* ulimit: Bash Builtins. (line 641) + (line 283) +* type: Bash Builtins. (line 626) +* typeset: Bash Builtins. (line 657) +* ulimit: Bash Builtins. (line 663) * umask: Bourne Shell Builtins. - (line 322) -* unalias: Bash Builtins. (line 703) + (line 324) +* unalias: Bash Builtins. (line 725) * unset: Bourne Shell Builtins. - (line 339) + (line 341) * wait: Job Control Builtins. (line 73) @@ -8923,9 +9052,9 @@ Index of Shell Reserved Words * !: Pipelines. (line 8) * [[: Conditional Constructs. - (line 105) + (line 108) * ]]: Conditional Constructs. - (line 105) + (line 108) * case: Conditional Constructs. (line 28) * do: Looping Constructs. (line 12) @@ -8945,7 +9074,7 @@ Index of Shell Reserved Words * in: Conditional Constructs. (line 28) * select: Conditional Constructs. - (line 64) + (line 67) * then: Conditional Constructs. (line 7) * time: Pipelines. (line 8) @@ -8963,153 +9092,156 @@ Parameter and Variable Index * Menu: -* !: Special Parameters. (line 42) -* #: Special Parameters. (line 26) -* $: Special Parameters. (line 38) +* !: Special Parameters. (line 46) +* #: Special Parameters. (line 30) +* $: Special Parameters. (line 42) * *: Special Parameters. (line 9) -* -: Special Parameters. (line 33) -* 0: Special Parameters. (line 46) -* ?: Special Parameters. (line 29) +* -: Special Parameters. (line 37) +* 0: Special Parameters. (line 50) +* ?: Special Parameters. (line 33) * @: Special Parameters. (line 19) -* _: Special Parameters. (line 55) +* _: Special Parameters. (line 59) * auto_resume: Job Control Variables. (line 6) * BASH: Bash Variables. (line 13) * BASH_ARGC: Bash Variables. (line 16) -* BASH_ARGV: Bash Variables. (line 24) -* BASH_COMMAND: Bash Variables. (line 31) -* BASH_ENV: Bash Variables. (line 36) -* BASH_EXECUTION_STRING: Bash Variables. (line 42) -* BASH_LINENO: Bash Variables. (line 45) -* BASH_REMATCH: Bash Variables. (line 53) -* BASH_SOURCE: Bash Variables. (line 61) -* BASH_SUBSHELL: Bash Variables. (line 65) -* BASH_VERSINFO: Bash Variables. (line 69) -* BASH_VERSION: Bash Variables. (line 93) +* BASH_ARGV: Bash Variables. (line 26) +* BASH_COMMAND: Bash Variables. (line 36) +* BASH_ENV: Bash Variables. (line 41) +* BASH_EXECUTION_STRING: Bash Variables. (line 47) +* BASH_LINENO: Bash Variables. (line 50) +* BASH_REMATCH: Bash Variables. (line 58) +* BASH_SOURCE: Bash Variables. (line 66) +* BASH_SUBSHELL: Bash Variables. (line 70) +* BASH_VERSINFO: Bash Variables. (line 74) +* BASH_VERSION: Bash Variables. (line 98) * bell-style: Readline Init File Syntax. - (line 34) + (line 38) +* bind-tty-special-chars: Readline Init File Syntax. + (line 45) * CDPATH: Bourne Shell Variables. (line 9) -* COLUMNS: Bash Variables. (line 96) +* COLUMNS: Bash Variables. (line 101) * comment-begin: Readline Init File Syntax. - (line 41) -* COMP_CWORD: Bash Variables. (line 101) -* COMP_LINE: Bash Variables. (line 107) -* COMP_POINT: Bash Variables. (line 112) -* COMP_WORDBREAKS: Bash Variables. (line 120) -* COMP_WORDS: Bash Variables. (line 126) + (line 50) +* COMP_CWORD: Bash Variables. (line 106) +* COMP_LINE: Bash Variables. (line 112) +* COMP_POINT: Bash Variables. (line 117) +* COMP_WORDBREAKS: Bash Variables. (line 125) +* COMP_WORDS: Bash Variables. (line 131) * completion-query-items: Readline Init File Syntax. - (line 51) -* COMPREPLY: Bash Variables. (line 132) -* convert-meta: Readline Init File Syntax. (line 60) -* DIRSTACK: Bash Variables. (line 137) +* COMPREPLY: Bash Variables. (line 137) +* convert-meta: Readline Init File Syntax. + (line 70) +* DIRSTACK: Bash Variables. (line 142) * disable-completion: Readline Init File Syntax. - (line 66) + (line 76) * editing-mode: Readline Init File Syntax. - (line 71) -* EMACS: Bash Variables. (line 147) + (line 81) +* EMACS: Bash Variables. (line 152) * enable-keypad: Readline Init File Syntax. - (line 77) -* EUID: Bash Variables. (line 152) + (line 87) +* EUID: Bash Variables. (line 157) * expand-tilde: Readline Init File Syntax. - (line 82) -* FCEDIT: Bash Variables. (line 156) -* FIGNORE: Bash Variables. (line 160) -* FUNCNAME: Bash Variables. (line 166) -* GLOBIGNORE: Bash Variables. (line 175) -* GROUPS: Bash Variables. (line 181) -* histchars: Bash Variables. (line 187) -* HISTCMD: Bash Variables. (line 202) -* HISTCONTROL: Bash Variables. (line 207) -* HISTFILE: Bash Variables. (line 223) -* HISTFILESIZE: Bash Variables. (line 227) -* HISTIGNORE: Bash Variables. (line 234) + (line 92) +* FCEDIT: Bash Variables. (line 161) +* FIGNORE: Bash Variables. (line 165) +* FUNCNAME: Bash Variables. (line 171) +* GLOBIGNORE: Bash Variables. (line 180) +* GROUPS: Bash Variables. (line 186) +* histchars: Bash Variables. (line 192) +* HISTCMD: Bash Variables. (line 207) +* HISTCONTROL: Bash Variables. (line 212) +* HISTFILE: Bash Variables. (line 228) +* HISTFILESIZE: Bash Variables. (line 232) +* HISTIGNORE: Bash Variables. (line 239) * history-preserve-point: Readline Init File Syntax. - (line 85) -* HISTSIZE: Bash Variables. (line 253) -* HISTTIMEFORMAT: Bash Variables. (line 257) + (line 96) +* HISTSIZE: Bash Variables. (line 258) +* HISTTIMEFORMAT: Bash Variables. (line 262) * HOME: Bourne Shell Variables. (line 13) * horizontal-scroll-mode: Readline Init File Syntax. - (line 90) -* HOSTFILE: Bash Variables. (line 264) -* HOSTNAME: Bash Variables. (line 275) -* HOSTTYPE: Bash Variables. (line 278) + (line 101) +* HOSTFILE: Bash Variables. (line 269) +* HOSTNAME: Bash Variables. (line 280) +* HOSTTYPE: Bash Variables. (line 283) * IFS: Bourne Shell Variables. (line 18) -* IGNOREEOF: Bash Variables. (line 281) +* IGNOREEOF: Bash Variables. (line 286) * input-meta: Readline Init File Syntax. - (line 97) -* INPUTRC: Bash Variables. (line 291) + (line 108) +* INPUTRC: Bash Variables. (line 296) * isearch-terminators: Readline Init File Syntax. - (line 104) + (line 115) * keymap: Readline Init File Syntax. - (line 111) -* LANG: Bash Variables. (line 295) -* LC_ALL: Bash Variables. (line 299) -* LC_COLLATE: Bash Variables. (line 303) -* LC_CTYPE: Bash Variables. (line 310) + (line 122) +* LANG: Bash Variables. (line 300) +* LC_ALL: Bash Variables. (line 304) +* LC_COLLATE: Bash Variables. (line 308) +* LC_CTYPE: Bash Variables. (line 315) * LC_MESSAGES <1>: Locale Translation. (line 11) -* LC_MESSAGES: Bash Variables. (line 315) -* LC_NUMERIC: Bash Variables. (line 319) -* LINENO: Bash Variables. (line 323) -* LINES: Bash Variables. (line 327) -* MACHTYPE: Bash Variables. (line 332) +* LC_MESSAGES: Bash Variables. (line 320) +* LC_NUMERIC: Bash Variables. (line 324) +* LINENO: Bash Variables. (line 328) +* LINES: Bash Variables. (line 332) +* MACHTYPE: Bash Variables. (line 337) * MAIL: Bourne Shell Variables. (line 22) -* MAILCHECK: Bash Variables. (line 336) +* MAILCHECK: Bash Variables. (line 341) * MAILPATH: Bourne Shell Variables. (line 27) * mark-modified-lines: Readline Init File Syntax. - (line 124) + (line 135) * mark-symlinked-directories: Readline Init File Syntax. - (line 129) + (line 140) * match-hidden-files: Readline Init File Syntax. - (line 134) + (line 145) * meta-flag: Readline Init File Syntax. - (line 97) -* OLDPWD: Bash Variables. (line 344) + (line 108) +* OLDPWD: Bash Variables. (line 349) * OPTARG: Bourne Shell Variables. (line 34) -* OPTERR: Bash Variables. (line 347) +* OPTERR: Bash Variables. (line 352) * OPTIND: Bourne Shell Variables. (line 38) -* OSTYPE: Bash Variables. (line 351) +* OSTYPE: Bash Variables. (line 356) * output-meta: Readline Init File Syntax. - (line 141) + (line 152) * page-completions: Readline Init File Syntax. - (line 146) + (line 157) * PATH: Bourne Shell Variables. (line 42) -* PIPESTATUS: Bash Variables. (line 354) -* POSIXLY_CORRECT: Bash Variables. (line 359) -* PPID: Bash Variables. (line 368) -* PROMPT_COMMAND: Bash Variables. (line 372) +* PIPESTATUS: Bash Variables. (line 359) +* POSIXLY_CORRECT: Bash Variables. (line 364) +* PPID: Bash Variables. (line 373) +* PROMPT_COMMAND: Bash Variables. (line 377) * PS1: Bourne Shell Variables. (line 48) * PS2: Bourne Shell Variables. (line 53) -* PS3: Bash Variables. (line 376) -* PS4: Bash Variables. (line 381) -* PWD: Bash Variables. (line 387) -* RANDOM: Bash Variables. (line 390) -* REPLY: Bash Variables. (line 395) -* SECONDS: Bash Variables. (line 398) -* SHELL: Bash Variables. (line 404) -* SHELLOPTS: Bash Variables. (line 409) -* SHLVL: Bash Variables. (line 418) +* PS3: Bash Variables. (line 381) +* PS4: Bash Variables. (line 386) +* PWD: Bash Variables. (line 392) +* RANDOM: Bash Variables. (line 395) +* REPLY: Bash Variables. (line 400) +* SECONDS: Bash Variables. (line 403) +* SHELL: Bash Variables. (line 409) +* SHELLOPTS: Bash Variables. (line 414) +* SHLVL: Bash Variables. (line 423) * show-all-if-ambiguous: Readline Init File Syntax. - (line 156) + (line 167) * show-all-if-unmodified: Readline Init File Syntax. - (line 162) + (line 173) * TEXTDOMAIN: Locale Translation. (line 11) * TEXTDOMAINDIR: Locale Translation. (line 11) -* TIMEFORMAT: Bash Variables. (line 423) -* TMOUT: Bash Variables. (line 461) -* UID: Bash Variables. (line 473) +* TIMEFORMAT: Bash Variables. (line 428) +* TMOUT: Bash Variables. (line 466) +* TMPDIR: Bash Variables. (line 478) +* UID: Bash Variables. (line 482) * visible-stats: Readline Init File Syntax. - (line 171) + (line 182) File: bashref.info, Node: Function Index, Next: Concept Index, Prev: Variable Index, Up: Top @@ -9209,7 +9341,7 @@ Function Index * unix-word-rubout (C-w): Commands For Killing. (line 28) * upcase-word (M-u): Commands For Text. (line 38) * yank (C-y): Commands For Killing. (line 59) -* yank-last-arg (M-. or M-_): Commands For History. (line 63) +* yank-last-arg (M-. or M-_): Commands For History. (line 65) * yank-nth-arg (M-C-y): Commands For History. (line 56) * yank-pop (M-y): Commands For Killing. (line 62) @@ -9298,7 +9430,7 @@ Concept Index * history list: Bash History Facilities. (line 6) * History, how to use: Programmable Completion Builtins. - (line 203) + (line 209) * identifier: Definitions. (line 49) * initialization file, readline: Readline Init File. (line 6) * installation: Basic Installation. (line 6) @@ -9366,7 +9498,7 @@ Concept Index * translation, native languages: Locale Translation. (line 6) * variable, shell: Shell Parameters. (line 6) * variables, readline: Readline Init File Syntax. - (line 33) + (line 37) * word: Definitions. (line 87) * word splitting: Word Splitting. (line 6) * yanking text: Readline Killing Commands. @@ -9375,129 +9507,129 @@ Concept Index Tag Table: -Node: Top1349 -Node: Introduction3485 -Node: What is Bash?3714 -Node: What is a shell?4807 -Node: Definitions7348 -Node: Basic Shell Features10089 -Node: Shell Syntax11308 -Node: Shell Operation12340 -Node: Quoting13634 -Node: Escape Character14908 -Node: Single Quotes15393 -Node: Double Quotes15741 -Node: ANSI-C Quoting16767 -Node: Locale Translation17723 -Node: Comments18619 -Node: Shell Commands19233 -Node: Simple Commands19999 -Node: Pipelines20630 -Node: Lists22505 -Node: Compound Commands24136 -Node: Looping Constructs24920 -Node: Conditional Constructs27367 -Node: Command Grouping34434 -Node: Shell Functions35883 -Node: Shell Parameters40151 -Node: Positional Parameters41732 -Node: Special Parameters42632 -Node: Shell Expansions45299 -Node: Brace Expansion47224 -Node: Tilde Expansion49549 -Node: Shell Parameter Expansion51890 -Node: Command Substitution59153 -Node: Arithmetic Expansion60486 -Node: Process Substitution61336 -Node: Word Splitting62386 -Node: Filename Expansion63847 -Node: Pattern Matching65983 -Node: Quote Removal69316 -Node: Redirections69611 -Node: Executing Commands77190 -Node: Simple Command Expansion77865 -Node: Command Search and Execution79795 -Node: Command Execution Environment81801 -Node: Environment84572 -Node: Exit Status86232 -Node: Signals87436 -Node: Shell Scripts89400 -Node: Shell Builtin Commands91918 -Node: Bourne Shell Builtins93497 -Node: Bash Builtins110450 -Node: The Set Builtin138577 -Node: Special Builtins146800 -Node: Shell Variables147777 -Node: Bourne Shell Variables148217 -Node: Bash Variables150198 -Node: Bash Features169913 -Node: Invoking Bash170796 -Node: Bash Startup Files176615 -Node: Interactive Shells181473 -Node: What is an Interactive Shell?181883 -Node: Is this Shell Interactive?182533 -Node: Interactive Shell Behavior183348 -Node: Bash Conditional Expressions186624 -Node: Shell Arithmetic190049 -Node: Aliases192794 -Node: Arrays195362 -Node: The Directory Stack198393 -Node: Directory Stack Builtins199107 -Node: Printing a Prompt201998 -Node: The Restricted Shell204712 -Node: Bash POSIX Mode206544 -Node: Job Control213197 -Node: Job Control Basics213664 -Node: Job Control Builtins217954 -Node: Job Control Variables222274 -Node: Command Line Editing223432 -Node: Introduction and Notation224431 -Node: Readline Interaction226053 -Node: Readline Bare Essentials227244 -Node: Readline Movement Commands229033 -Node: Readline Killing Commands229998 -Node: Readline Arguments231918 -Node: Searching232962 -Node: Readline Init File235148 -Node: Readline Init File Syntax236207 -Node: Conditional Init Constructs247860 -Node: Sample Init File250393 -Node: Bindable Readline Commands253510 -Node: Commands For Moving254717 -Node: Commands For History255578 -Node: Commands For Text258479 -Node: Commands For Killing261152 -Node: Numeric Arguments263294 -Node: Commands For Completion264433 -Node: Keyboard Macros268026 -Node: Miscellaneous Commands268597 -Node: Readline vi Mode273908 -Node: Programmable Completion274822 -Node: Programmable Completion Builtins280634 -Node: Using History Interactively288004 -Node: Bash History Facilities288684 -Node: Bash History Builtins291379 -Node: History Interaction295236 -Node: Event Designators297792 -Node: Word Designators298807 -Node: Modifiers300446 -Node: Installing Bash301852 -Node: Basic Installation302989 -Node: Compilers and Options305681 -Node: Compiling For Multiple Architectures306422 -Node: Installation Names308086 -Node: Specifying the System Type308904 -Node: Sharing Defaults309620 -Node: Operation Controls310293 -Node: Optional Features311251 -Node: Reporting Bugs319530 -Node: Major Differences From The Bourne Shell320724 -Node: Copying This Manual336496 -Node: GNU Free Documentation License336772 -Node: Builtin Index359178 -Node: Reserved Word Index365727 -Node: Variable Index368163 -Node: Function Index378882 -Node: Concept Index385602 +Node: Top1375 +Node: Introduction3475 +Node: What is Bash?3703 +Node: What is a shell?4796 +Node: Definitions7337 +Node: Basic Shell Features10078 +Node: Shell Syntax11297 +Node: Shell Operation12327 +Node: Quoting13621 +Node: Escape Character14924 +Node: Single Quotes15409 +Node: Double Quotes15757 +Node: ANSI-C Quoting16882 +Node: Locale Translation17838 +Node: Comments18734 +Node: Shell Commands19348 +Node: Simple Commands20114 +Node: Pipelines20745 +Node: Lists22620 +Node: Compound Commands24251 +Node: Looping Constructs25035 +Node: Conditional Constructs27482 +Node: Command Grouping34942 +Node: Shell Functions36391 +Node: Shell Parameters40681 +Node: Positional Parameters43011 +Node: Special Parameters43911 +Node: Shell Expansions46875 +Node: Brace Expansion48800 +Node: Tilde Expansion51125 +Node: Shell Parameter Expansion53476 +Node: Command Substitution60985 +Node: Arithmetic Expansion62318 +Node: Process Substitution63168 +Node: Word Splitting64218 +Node: Filename Expansion65679 +Node: Pattern Matching67815 +Node: Quote Removal71140 +Node: Redirections71435 +Node: Executing Commands79165 +Node: Simple Command Expansion79835 +Node: Command Search and Execution81765 +Node: Command Execution Environment83771 +Node: Environment86542 +Node: Exit Status88202 +Node: Signals89406 +Node: Shell Scripts91370 +Node: Shell Builtin Commands93888 +Node: Bourne Shell Builtins95549 +Node: Bash Builtins112632 +Node: The Set Builtin141675 +Node: Special Builtins150082 +Node: Shell Variables151059 +Node: Bourne Shell Variables151499 +Node: Bash Variables153480 +Node: Bash Features173666 +Node: Invoking Bash174549 +Node: Bash Startup Files180370 +Node: Interactive Shells185228 +Node: What is an Interactive Shell?185638 +Node: Is this Shell Interactive?186288 +Node: Interactive Shell Behavior187103 +Node: Bash Conditional Expressions190379 +Node: Shell Arithmetic193958 +Node: Aliases196704 +Node: Arrays199272 +Node: The Directory Stack202621 +Node: Directory Stack Builtins203335 +Node: Printing a Prompt206226 +Node: The Restricted Shell208940 +Node: Bash POSIX Mode210772 +Node: Job Control218589 +Node: Job Control Basics219056 +Node: Job Control Builtins223432 +Node: Job Control Variables227759 +Node: Command Line Editing228917 +Node: Introduction and Notation229916 +Node: Readline Interaction231538 +Node: Readline Bare Essentials232729 +Node: Readline Movement Commands234518 +Node: Readline Killing Commands235483 +Node: Readline Arguments237403 +Node: Searching238447 +Node: Readline Init File240633 +Node: Readline Init File Syntax241692 +Node: Conditional Init Constructs253908 +Node: Sample Init File256441 +Node: Bindable Readline Commands259558 +Node: Commands For Moving260765 +Node: Commands For History261626 +Node: Commands For Text264781 +Node: Commands For Killing267454 +Node: Numeric Arguments269596 +Node: Commands For Completion270735 +Node: Keyboard Macros274328 +Node: Miscellaneous Commands274899 +Node: Readline vi Mode280210 +Node: Programmable Completion281124 +Node: Programmable Completion Builtins286916 +Node: Using History Interactively294512 +Node: Bash History Facilities295192 +Node: Bash History Builtins297887 +Node: History Interaction301744 +Node: Event Designators304300 +Node: Word Designators305315 +Node: Modifiers306954 +Node: Installing Bash308360 +Node: Basic Installation309490 +Node: Compilers and Options312182 +Node: Compiling For Multiple Architectures312923 +Node: Installation Names314587 +Node: Specifying the System Type315405 +Node: Sharing Defaults316121 +Node: Operation Controls316794 +Node: Optional Features317752 +Node: Reporting Bugs326683 +Node: Major Differences From The Bourne Shell327877 +Node: Copying This Manual344575 +Node: GNU Free Documentation License344851 +Node: Builtin Index367257 +Node: Reserved Word Index373806 +Node: Variable Index376242 +Node: Function Index387175 +Node: Concept Index393895 End Tag Table diff --git a/doc/bashref.texi b/doc/bashref.texi index 96b9c01..b25dad9 100644 --- a/doc/bashref.texi +++ b/doc/bashref.texi @@ -16,7 +16,7 @@ This is Edition @value{EDITION}, last updated @value{UPDATED}, of @cite{The GNU Bash Reference Manual}, for @code{Bash}, Version @value{VERSION}. -Copyright @copyright{} 1988-2004 Free Software Foundation, Inc. +Copyright @copyright{} 1988-2005 Free Software Foundation, Inc. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice @@ -94,46 +94,28 @@ reference on shell behavior. @menu * Introduction:: An introduction to the shell. - * Definitions:: Some definitions used in the rest of this manual. - * Basic Shell Features:: The shell "building blocks". - * Shell Builtin Commands:: Commands that are a part of the shell. - * Shell Variables:: Variables used or set by Bash. - * Bash Features:: Features found only in Bash. - -* Job Control:: A chapter describing what job control is - and how Bash allows you to use it. - -* Using History Interactively:: Chapter dealing with history expansion - rules. - +* Job Control:: What job control is and how Bash allows you + to use it. +* Using History Interactively:: Command History Expansion * Command Line Editing:: Chapter describing the command line editing features. - * Installing Bash:: How to build and install Bash on your system. - * Reporting Bugs:: How to report bugs in Bash. - * Major Differences From The Bourne Shell:: A terse list of the differences between Bash and historical versions of /bin/sh. - * Copying This Manual:: Copying this manual. - * Builtin Index:: Index of Bash builtin commands. - * Reserved Word Index:: Index of Bash reserved words. - * Variable Index:: Quick reference helps you find the variable you want. - * Function Index:: Index of bindable Readline functions. - * Concept Index:: General index for concepts described in this manual. @end menu @@ -143,7 +125,6 @@ reference on shell behavior. @chapter Introduction @menu * What is Bash?:: A short description of Bash. - * What is a shell?:: A brief introduction to shells. @end menu @@ -371,9 +352,7 @@ and to named files, and how the shell executes commands. @section Shell Syntax @menu * Shell Operation:: The basic operation of the shell. - * Quoting:: How to remove the special meaning from characters. - * Comments:: How to specify comments. @end menu @@ -444,7 +423,6 @@ status (@pxref{Exit Status}). * Double Quotes:: How to suppress most of the interpretation of a sequence of characters. * ANSI-C Quoting:: How to expand ANSI-C sequences in quoted strings. - * Locale Translation:: How to translate strings into different languages. @end menu @@ -457,7 +435,8 @@ parameter expansion. Each of the shell metacharacters (@pxref{Definitions}) has special meaning to the shell and must be quoted if it is to represent itself. -When the command history expansion facilities are being used, the +When the command history expansion facilities are being used +(@pxref{History Interaction}), the @var{history expansion} character, usually @samp{!}, must be quoted to prevent history expansion. @xref{Bash History Facilities}, for more details concerning history expansion. @@ -486,7 +465,8 @@ between single quotes, even when preceded by a backslash. Enclosing characters in double quotes (@samp{"}) preserves the literal value of all characters within the quotes, with the exception of -@samp{$}, @samp{`}, and @samp{\}. +@samp{$}, @samp{`}, @samp{\}, +and, when history expansion is enabled, @samp{!}. The characters @samp{$} and @samp{`} retain their special meaning within double quotes (@pxref{Shell Expansions}). The backslash retains its special meaning only when followed by one of @@ -497,8 +477,9 @@ characters are removed. Backslashes preceding characters without a special meaning are left unmodified. A double quote may be quoted within double quotes by preceding it with a backslash. -When command history is being used, the double quote may not be used to -quote the history expansion character. +If enabled, history expansion will be performed unless an @samp{!} +appearing in double quotes is escaped using a backslash. +The backslash preceding the @samp{!} is not removed. The special parameters @samp{*} and @samp{@@} have special meaning when in double quotes (@pxref{Shell Parameter Expansion}). @@ -864,6 +845,10 @@ The syntax of the @code{case} command is: @code{case} will selectively execute the @var{command-list} corresponding to the first @var{pattern} that matches @var{word}. +If the shell option @code{nocasematch} +(see the description of @code{shopt} in @ref{Bash Builtins}) +is enabled, the match is performed without regard to the case +of alphabetic characters. The @samp{|} is used to separate multiple patterns, and the @samp{)} operator terminates a pattern list. A list of patterns and an associated command-list is known @@ -972,6 +957,10 @@ as primaries. When the @samp{==} and @samp{!=} operators are used, the string to the right of the operator is considered a pattern and matched according to the rules described below in @ref{Pattern Matching}. +If the shell option @code{nocasematch} +(see the description of @code{shopt} in @ref{Bash Builtins}) +is enabled, the match is performed without regard to the case +of alphabetic characters. The return value is 0 if the string matches or does not match the pattern, respectively, and 1 otherwise. Any part of the pattern may be quoted to force it to be matched as a @@ -985,7 +974,7 @@ The return value is 0 if the string matches the pattern, and 1 otherwise. If the regular expression is syntactically incorrect, the conditional expression's return value is 2. -If the shell option @code{nocaseglob} +If the shell option @code{nocasematch} (see the description of @code{shopt} in @ref{Bash Builtins}) is enabled, the match is performed without regard to the case of alphabetic characters. @@ -1118,12 +1107,12 @@ The first element of the @env{FUNCNAME} variable is set to the name of the function while the function is executing. All other aspects of the shell execution environment are identical between a function and its caller -with the exception that the @env{DEBUG} trap -below) is not inherited unless the function has been given the +with the exception that the @env{DEBUG} and @env{RETURN} traps +are not inherited unless the function has been given the @code{trace} attribute using the @code{declare} builtin or the @code{-o functrace} option has been enabled with the @code{set} builtin, -(in which case all functions inherit the @code{DEBUG} trap). +(in which case all functions inherit the @env{DEBUG} and @env{RETURN} traps). @xref{Bourne Shell Builtins}, for the description of the @code{trap} builtin. @@ -1208,6 +1197,21 @@ Assignment statements may also appear as arguments to the @code{declare}, @code{typeset}, @code{export}, @code{readonly}, and @code{local} builtin commands. +In the context where an assignment statement is assigning a value +to a shell variable or array index (@pxref{Arrays}), the @samp{+=} +operator can be used to +append to or add to the variable's previous value. +When @samp{+=} is applied to a variable for which the integer attribute +has been set, @var{value} is evaluated as an arithmetic expression and +added to the variable's current value, which is also evaluated. +When @samp{+=} is applied to an array variable using compound assignment +(@pxref{Arrays}), the +variable's value is not unset (as it is when using @samp{=}), and new +values are appended to the array beginning at one greater than the array's +maximum index. +When applied to a string-valued variable, @var{value} is expanded and +appended to the variable's value. + @node Positional Parameters @subsection Positional Parameters @cindex parameters, positional @@ -1256,6 +1260,10 @@ Expands to the positional parameters, starting from one. When the expansion occurs within double quotes, each parameter expands to a separate word. That is, @code{"$@@"} is equivalent to @code{"$1" "$2" @dots{}}. +If the double-quoted expansion occurs within a word, the expansion of +the first parameter is joined with the beginning part of the original +word, and the expansion of the last parameter is joined with the last +part of the original word. When there are no positional parameters, @code{"$@@"} and @code{$@@} expand to nothing (i.e., they are removed). @@ -1292,12 +1300,13 @@ to the filename used to invoke Bash, as given by argument zero. @item _ (An underscore.) -At shell startup, set to the absolute filename of the shell or shell -script being executed as passed in the argument list. +At shell startup, set to the absolute pathname used to invoke the +shell or shell script being executed as passed in the environment +or argument list. Subsequently, expands to the last argument to the previous command, after expansion. -Also set to the full pathname of each command executed and placed in -the environment exported to that command. +Also set to the full pathname used to invoke each command executed +and placed in the environment exported to that command. When checking mail, this parameter holds the name of the mail file. @end vtable @@ -1452,7 +1461,7 @@ If the login name is invalid, or the tilde expansion fails, the word is left unchanged. Each variable assignment is checked for unquoted tilde-prefixes immediately -following a @samp{:} or @samp{=}. +following a @samp{:} or the first @samp{=}. In these cases, tilde expansion is also performed. Consequently, one may use file names with tildes in assignments to @env{PATH}, @env{MAILPATH}, and @env{CDPATH}, @@ -1580,6 +1589,10 @@ parameters beginning at @var{offset}. If @var{parameter} is an array name indexed by @samp{@@} or @samp{*}, the result is the @var{length} members of the array beginning with @code{$@{@var{parameter}[@var{offset}]@}}. +A negative @var{offset} is taken relative to one greater than the maximum +index of the specified array. +Note that a negative offset must be separated from the colon by at least +one space to avoid being confused with the @samp{:-} expansion. Substring indexing is zero-based unless the positional parameters are used, in which case the indexing starts at 1. @@ -1927,7 +1940,7 @@ Matches zero or more occurrences of the given patterns. Matches one or more occurrences of the given patterns. @item @@(@var{pattern-list}) -Matches exactly one of the given patterns. +Matches one of the given patterns. @item !(@var{pattern-list}) Matches anything except one of the given patterns. @@ -2013,6 +2026,10 @@ connection to the corresponding socket. A failure to open or create a file causes the redirection to fail. +Redirections using file descriptors greater than 9 should be used with +care, as they may conflict with file descriptors the shell uses +internally. + @subsection Redirecting Input Redirection of input causes the file whose name results from the expansion of @var{word} @@ -2188,21 +2205,15 @@ is not specified. If the file does not exist, it is created. @menu * Simple Command Expansion:: How Bash expands simple commands before executing them. - * Command Search and Execution:: How Bash finds commands and runs them. - * Command Execution Environment:: The environment in which Bash executes commands that are not shell builtins. - * Environment:: The environment given to a command. - * Exit Status:: The status returned by commands and how Bash interprets it. - * Signals:: What happens when Bash or a command it runs receives a signal. - @end menu @node Simple Command Expansion @@ -2603,6 +2614,8 @@ Many of the builtins have been extended by @sc{posix} or Bash. Unless otherwise noted, each builtin command documented as accepting options preceded by @samp{-} accepts @samp{--} to signify the end of the options. +For example, the @code{:}, @code{true}, @code{false}, and @code{test} +builtins do not accept options. @node Bourne Shell Builtins @section Bourne Shell Builtins @@ -2893,6 +2906,8 @@ Evaluate a conditional expression @var{expr}. Each operator and operand must be a separate argument. Expressions are composed of the primaries described below in @ref{Bash Conditional Expressions}. +@code{test} does not accept any options, nor does it accept and ignore +an argument of @option{--} as signifying the end of options. When the @code{[} form is used, the last argument to the command must be a @code{]}. @@ -3256,7 +3271,8 @@ by subsequent assignment statements or unset. @item -t Give each @var{name} the @code{trace} attribute. -Traced functions inherit the @code{DEBUG} trap from the calling shell. +Traced functions inherit the @code{DEBUG} and @code{RETURN} traps from +the calling shell. The trace attribute has no special meaning for variables. @item -x @@ -3295,6 +3311,8 @@ even on systems where they are interpreted by default. The @code{xpg_echo} shell option may be used to dynamically determine whether or not @code{echo} expands these escape characters by default. +@code{echo} does not interpret @option{--} to mean the end of options. + @code{echo} interprets the following escape sequences: @table @code @item \a @@ -3409,7 +3427,7 @@ parent. @item printf @btindex printf @example -@code{printf} @var{format} [@var{arguments}] +@code{printf} [-v @var{var}] @var{format} [@var{arguments}] @end example Write the formatted @var{arguments} to the standard output under the control of the @var{format}. @@ -3427,6 +3445,9 @@ beginning with @samp{\0} may contain up to four digits), and @samp{%q} causes @code{printf} to output the corresponding @var{argument} in a format that can be reused as shell input. +The @option{-v} option causes the output to be assigned to the variable +@var{var} rather than being printed to the standard output. + The @var{format} is reused as necessary to consume all of the @var{arguments}. If the @var{format} requires more @var{arguments} than are supplied, the extra format specifications behave as if a zero value or null string, as @@ -3610,6 +3631,20 @@ If the command run by the @code{DEBUG} trap returns a value of 2, and the shell is executing in a subroutine (a shell function or a shell script executed by the @code{.} or @code{source} builtins), a call to @code{return} is simulated. + +@item +@code{BASH_ARGC} and @code{BASH_ARGV} are updated as described in their +descriptions (@pxref{Bash Variables}). + +@item +Function tracing is enabled: command substitution, shell functions, and +subshells invoked with @code{( @var{command} )} inherit the +@code{DEBUG} and @code{RETURN} traps. + +@item +Error tracing is enabled: command substitution, shell functions, and +subshells invoked with @code{( @var{command} )} inherit the +@code{ERROR} trap. @end enumerate @item extglob @@ -3692,6 +3727,11 @@ on an empty line. If set, Bash matches filenames in a case-insensitive fashion when performing filename expansion. +@item nocasematch +If set, Bash matches patterns in a case-insensitive fashion when +performing matching while executing @code{case} or @code{[[} +conditional commands. + @item nullglob If set, Bash allows filename patterns which match no files to expand to a null string, rather than themselves. @@ -3885,7 +3925,10 @@ set [--abefhkmnptuvxBCHP] [-o @var{option}] [@var{argument} @dots{}] If no options or arguments are supplied, @code{set} displays the names and values of all shell variables and functions, sorted according to the -current locale, in a format that may be reused as input. +current locale, in a format that may be reused as input +for setting or resetting the currently-set variables. +Read-only variables cannot be reset. +In @sc{posix} mode, only shell variables are listed. When options are supplied, they set or unset shell attributes. Options, if specified, have the following meanings: @@ -4096,9 +4139,11 @@ $ cd ..; pwd @end example @item -T -If set, any trap on @code{DEBUG} is inherited by shell functions, command -substitutions, and commands executed in a subshell environment. -The @code{DEBUG} trap is normally not inherited in such cases. +If set, any trap on @code{DEBUG} and @code{RETURN} are inherited by +shell functions, command substitutions, and commands executed +in a subshell environment. +The @code{DEBUG} and @code{RETURN} traps are normally not inherited +in such cases. @item -- If no arguments follow this option, then the positional parameters are @@ -4249,6 +4294,10 @@ parameters to the current subroutine (shell function or script executed with @code{.} or @code{source}) is at the top of the stack. When a subroutine is executed, the number of parameters passed is pushed onto @code{BASH_ARGC}. +The shell sets @code{BASH_ARGC} only when in extended debugging mode +(see @ref{Bash Builtins} +for a description of the @code{extdebug} option to the @code{shopt} +builtin). @item BASH_ARGV An array variable containing all of the parameters in the current bash @@ -4256,6 +4305,10 @@ execution call stack. The final parameter of the last subroutine call is at the top of the stack; the first parameter of the initial call is at the bottom. When a subroutine is executed, the parameters supplied are pushed onto @code{BASH_ARGV}. +The shell sets @code{BASH_ARGV} only when in extended debugging mode +(see @ref{Bash Builtins} +for a description of the @code{extdebug} option to the @code{shopt} +builtin). @item BASH_COMMAND The command currently being executed or about to be executed, unless the @@ -4274,8 +4327,8 @@ The command argument to the @option{-c} invocation option. An array variable whose members are the line numbers in source files corresponding to each member of @var{FUNCNAME}. @code{$@{BASH_LINENO[$i]@}} is the line number in the source file where -@code{$@{FUNCNAME[$i + 1]@}} was called. -The corresponding source file name is @code{$@{BASH_SOURCE[$i + 1]@}}. +@code{$@{FUNCNAME[$i]@}} was called. +The corresponding source file name is @code{$@{BASH_SOURCE[$i]@}}. Use @code{LINENO} to obtain the current line number. @item BASH_REMATCH @@ -4731,6 +4784,10 @@ prompt when the shell is interactive. Bash terminates after that number of seconds if input does not arrive. +@item TMPDIR +If set, Bash uses its value as the name of a directory in which +Bash creates temporary files for the shell's use. + @item UID The numeric real user id of the current user. This variable is readonly. @@ -4783,7 +4840,7 @@ option). @item --dump-po-strings A list of all double-quoted strings preceded by @samp{$} -is printed on the standard ouput +is printed on the standard output in the @sc{gnu} @code{gettext} PO (portable object) file format. Equivalent to @option{-D} except for the output format. @@ -4870,7 +4927,7 @@ when invoking an interactive shell. @item -D A list of all double-quoted strings preceded by @samp{$} -is printed on the standard ouput. +is printed on the standard output. These are the strings that are subject to language translation when the current locale is not @code{C} or @code{POSIX} (@pxref{Locale Translation}). @@ -5166,6 +5223,7 @@ shell to exit. @item When running in @sc{posix} mode, a special builtin returning an error status will not cause the shell to exit (@pxref{Bash POSIX Mode}). + @item A failed @code{exec} will not cause the shell to exit (@pxref{Bourne Shell Builtins}). @@ -5201,6 +5259,9 @@ If the @var{file} argument to one of the primaries is one of @file{/dev/stdin}, @file{/dev/stdout}, or @file{/dev/stderr}, file descriptor 0, 1, or 2, respectively, is checked. +Unless otherwise specified, primaries that operate on files follow symbolic +links and operate on the target of the link, rather than the link itself. + @table @code @item -a @var{file} True if @var{file} exists. @@ -5414,7 +5475,7 @@ omitted, then base 10 is used. The digits greater than 9 are represented by the lowercase letters, the uppercase letters, @samp{@@}, and @samp{_}, in that order. If @var{base} is less than or equal to 36, lowercase and uppercase -letters may be used interchangably to represent numbers between 10 +letters may be used interchangeably to represent numbers between 10 and 35. Operators are evaluated in order of precedence. Sub-expressions in @@ -5534,12 +5595,18 @@ The braces are required to avoid conflicts with the shell's filename expansion operators. If the @var{subscript} is @samp{@@} or @samp{*}, the word expands to all members of the array @var{name}. These subscripts differ only when the word -appears within double quotes. If the word is double-quoted, +appears within double quotes. +If the word is double-quoted, @code{$@{name[*]@}} expands to a single word with the value of each array member separated by the first character of the @env{IFS} variable, and @code{$@{name[@@]@}} expands each element of @var{name} to a separate word. When there are no array members, -@code{$@{name[@@]@}} expands to nothing. This is analogous to the +@code{$@{name[@@]@}} expands to nothing. +If the double-quoted expansion occurs within a word, the expansion of +the first parameter is joined with the beginning part of the original +word, and the expansion of the last parameter is joined with the last +part of the original word. +This is analogous to the expansion of the special parameters @samp{@@} and @samp{*}. @code{$@{#name[}@var{subscript}@code{]@}} expands to the length of @code{$@{name[}@var{subscript}@code{]@}}. @@ -5551,6 +5618,8 @@ referencing element zero. The @code{unset} builtin is used to destroy arrays. @code{unset} @var{name}[@var{subscript}] destroys the array element at index @var{subscript}. +Care must be taken to avoid unwanted side effects caused by filename +generation. @code{unset} @var{name}, where @var{name} is an array, removes the entire array. A subscript of @samp{*} or @samp{@@} also removes the entire array. @@ -5843,7 +5912,13 @@ is stopped is `Stopped(@var{signame})', where @var{signame} is, for example, @code{SIGTSTP}. @item -Reserved words may not be aliased. +The @code{bg} builtin uses the required format to describe each job placed +in the background, which does not include an indication of whether the job +is the current or previous job. + +@item +Reserved words appearing in a context where reserved words are recognized +do not undergo alias expansion. @item The @sc{posix} 1003.2 @env{PS1} and @env{PS2} expansions of @samp{!} to @@ -5894,7 +5969,7 @@ may not start with a digit. Declaring a function with an invalid name causes a fatal syntax error in non-interactive shells. @item -@sc{posix} 1003.2 `special' builtins are found before shell functions +@sc{posix} 1003.2 special builtins are found before shell functions during command lookup. @item @@ -5905,12 +5980,6 @@ redirection errors, variable assignment errors for assignments preceding the command name, and so on. @item -If the @code{cd} builtin finds a directory to change to -using @env{$CDPATH}, the -value it assigns to the @env{PWD} variable does not contain any -symbolic links, as if @samp{cd -P} had been executed. - -@item If @env{CDPATH} is set, the @code{cd} builtin will not implicitly append the current directory to it. This means that @code{cd} will fail if no valid directory name can be constructed from @@ -5989,29 +6058,61 @@ When the @code{cd} builtin is invoked in @var{logical} mode, and the pathname constructed from @code{$PWD} and the directory name supplied as an argument does not refer to an existing directory, @code{cd} will fail instead of falling back to @var{physical} mode. + +@item +When the @code{pwd} builtin is supplied the @option{-P} option, it resets +@code{$PWD} to a pathname containing no symlinks. + +@item +The @code{pwd} builtin verifies that the value it prints is the same as the +current directory, even if it is not asked to check the file system with the +@option{-P} option. + +@item +When listing the history, the @code{fc} builtin does not include an +indication of whether or not a history entry has been modified. + +@item +The default editor used by @code{fc} is @code{ed}. + +@item +The @code{type} and @code{command} builtins will not report a non-executable +file as having been found, though the shell will attempt to execute such a +file if it is the only so-named file found in @code{$PATH}. + +@item +The @code{vi} editing mode will invoke the @code{vi} editor directly when +the @samp{v} command is run, instead of checking @code{$FCEDIT} and +@code{$EDITOR}. + +@item +When the @code{xpg_echo} option is enabled, Bash does not attempt to interpret +any arguments to @code{echo} as options. Each argument is displayed, after +escape characters are converted. + @end enumerate -There is other @sc{posix} 1003.2 behavior that Bash does not implement. +There is other @sc{posix} 1003.2 behavior that Bash does not implement by +default even when in @sc{posix} mode. Specifically: @enumerate -@item -Assignment statements affect the execution environment of all -builtins, not just special ones. @item -When a subshell is created to execute a shell script with execute permission, -but without a leading @samp{#!}, Bash sets @code{$0} to the full pathname of -the script as found by searching @code{$PATH}, rather than the command as -typed by the user. +The @code{fc} builtin checks @code{$EDITOR} as a program to edit history +entries if @code{FCEDIT} is unset, rather than defaulting directly to +@code{ed}. @code{fc} uses @code{ed} if @code{EDITOR} is unset. @item -When using @samp{.} to source a shell script found in @code{$PATH}, bash -checks execute permission bits rather than read permission bits, just as -if it were searching for a command. +As noted above, Bash requires the @code{xpg_echo} option to be enabled for +the @code{echo} builtin to be fully conformant. @end enumerate +Bash can be configured to be @sc{posix}-conformant by default, by specifying +the @option{--enable-strict-posix-default} to @code{configure} when building +(@pxref{Optional Features}). + @node Job Control @chapter Job Control @@ -6087,11 +6188,12 @@ There are a number of ways to refer to a job in the shell. The character @samp{%} introduces a job name. Job number @code{n} may be referred to as @samp{%n}. -The symbols @samp{%%} and -@samp{%+} refer to the shell's notion of the current job, which -is the last job stopped while it was in the foreground or started -in the background. The -previous job may be referenced using @samp{%-}. In output +The symbols @samp{%%} and @samp{%+} refer to the shell's notion of the +current job, which is the last job stopped while it was in the foreground +or started in the background. +A single @samp{%} (with no accompanying job specification) also refers +to the current job. +The previous job may be referenced using @samp{%-}. In output pertaining to jobs (e.g., the output of the @code{jobs} command), the current job is always flagged with a @samp{+}, and the previous job with a @samp{-}. @@ -6132,15 +6234,15 @@ Bash does not print another warning, and the stopped jobs are terminated. @item bg @btindex bg @example -bg [@var{jobspec}] +bg [@var{jobspec} @dots{}] @end example -Resume the suspended job @var{jobspec} in the background, as if it +Resume each suspended job @var{jobspec} in the background, as if it had been started with @samp{&}. If @var{jobspec} is not supplied, the current job is used. The return status is zero unless it is run when job control is not -enabled, or, when run with job control enabled, if @var{jobspec} was -not found or @var{jobspec} specifies a job that was started without -job control. +enabled, or, when run with job control enabled, any +@var{jobspec} was not found or specifies a job +that was started without job control. @item fg @btindex fg @@ -6216,11 +6318,11 @@ or non-zero if an error occurs or an invalid option is encountered. @item wait @btindex wait @example -wait [@var{jobspec} or @var{pid}] +wait [@var{jobspec} or @var{pid} ...] @end example -Wait until the child process specified by process @sc{id} @var{pid} or job -specification @var{jobspec} exits and return the exit status of the last -command waited for. +Wait until the child process specified by each process @sc{id} @var{pid} +or job specification @var{jobspec} exits and return the exit status of the +last command waited for. If a job spec is given, all processes in the job are waited for. If no arguments are given, all currently active child processes are waited for, and the return status is zero. @@ -6304,23 +6406,16 @@ Other independent ports exist for @menu * Basic Installation:: Installation instructions. - * Compilers and Options:: How to set special options for various systems. - * Compiling For Multiple Architectures:: How to compile Bash for more than one kind of system from the same source tree. - * Installation Names:: How to set the various paths used by the installation. - * Specifying the System Type:: How to configure Bash for a particular system. - * Sharing Defaults:: How to share default configuration values among GNU programs. - * Operation Controls:: Options recognized by the configuration program. - * Optional Features:: How to enable and disable optional features when building Bash. @end menu @@ -6561,10 +6656,10 @@ Define if you are using the Andrew File System from Transarc. @item --with-bash-malloc Use the Bash version of -@code{malloc} in @file{lib/malloc/malloc.c}. This is not the same +@code{malloc} in the directory @file{lib/malloc}. This is not the same @code{malloc} that appears in @sc{gnu} libc, but an older version -derived from the 4.2 @sc{bsd} @code{malloc}. This @code{malloc} is -very fast, but wastes some space on each allocation. +originally derived from the 4.2 @sc{bsd} @code{malloc}. This @code{malloc} +is very fast, but wastes some space on each allocation. This option is enabled by default. The @file{NOTES} file contains a list of systems for which this should be turned off, and @code{configure} disables this @@ -6581,7 +6676,7 @@ A synonym for @code{--with-bash-malloc}. @item --with-installed-readline[=@var{PREFIX}] Define this to make Bash link with a locally-installed version of Readline rather than the version in @file{lib/readline}. This works only with -Readline 4.3 and later versions. If @var{PREFIX} is @code{yes} or not +Readline 5.0 and later versions. If @var{PREFIX} is @code{yes} or not supplied, @code{configure} uses the values of the make variables @code{includedir} and @code{libdir}, which are subdirectories of @code{prefix} by default, to find the installed version of Readline if it is not in @@ -6669,6 +6764,9 @@ Include support for matching POSIX regular expressions using the @samp{=~} binary operator in the @code{[[} conditional command. (@pxref{Conditional Constructs}). +@item --enable-debugger +Include support for the bash debugger (distributed separately). + @item --enable-directory-stack Include support for a @code{csh}-like directory stack and the @code{pushd}, @code{popd}, and @code{dirs} builtins @@ -6714,17 +6812,17 @@ when used in redirections (@pxref{Redirections}). This enables process substitution (@pxref{Process Substitution}) if the operating system provides the necessary support. +@item --enable-progcomp +Enable the programmable completion facilities +(@pxref{Programmable Completion}). +If Readline is not enabled, this option has no effect. + @item --enable-prompt-string-decoding Turn on the interpretation of a number of backslash-escaped characters in the @env{$PS1}, @env{$PS2}, @env{$PS3}, and @env{$PS4} prompt strings. See @ref{Printing a Prompt}, for a complete list of prompt string escape sequences. -@item --enable-progcomp -Enable the programmable completion facilities -(@pxref{Programmable Completion}). -If Readline is not enabled, this option has no effect. - @item --enable-readline Include support for command-line editing and history with the Bash version of the Readline library (@pxref{Command Line Editing}). @@ -6738,6 +6836,19 @@ when called as @code{rbash}, enters a restricted mode. See Include the @code{select} builtin, which allows the generation of simple menus (@pxref{Conditional Constructs}). +@item --enable-separate-helpfiles +Use external files for the documentation displayed by the @code{help} builtin +instead of storing the text internally. + +@item --enable-single-help-strings +Store the text displayed by the @code{help} builtin as a single string for +each help topic. This aids in translating the text to different languages. +You may need to disable this if your compiler cannot handle very long string +literals. + +@item --enable-strict-posix-default +Make Bash @sc{posix}-conformant by default (@pxref{Bash POSIX Mode}). + @item --enable-usg-echo-default A synonym for @code{--enable-xpg-echo-default}. @@ -6746,7 +6857,7 @@ Make the @code{echo} builtin expand backslash-escaped characters by default, without requiring the @option{-e} option. This sets the default value of the @code{xpg_echo} shell option to @code{on}, which makes the Bash @code{echo} behave more like the version specified in -the Single Unix Specification, version 2. +the Single Unix Specification, version 3. @xref{Bash Builtins}, for a description of the escape sequences that @code{echo} recognizes. @@ -6810,8 +6921,8 @@ differences between the traditional Bourne shell and Bash; this section quickly details the differences of significance. A number of these differences are explained in greater depth in previous sections. -This section uses the version of @code{sh} included in SVR4.2 as -the baseline reference. +This section uses the version of @code{sh} included in SVR4.2 (the +last version of the historical Bourne shell) as the baseline reference. @itemize @bullet @@ -6863,6 +6974,8 @@ invocation options list the translatable strings found in a script Bash implements the @code{!} keyword to negate the return value of a pipeline (@pxref{Pipelines}). Very useful when an @code{if} statement needs to act only if a test fails. +The Bash @samp{-o pipefail} option to @code{set} will cause a pipeline to +return a failure status if any command fails. @item Bash has the @code{time} reserved word and command timing (@pxref{Pipelines}). @@ -6879,7 +6992,12 @@ generation of simple menus (@pxref{Conditional Constructs}). @item Bash includes the @code{[[} compound command, which makes conditional -testing part of the shell grammar (@pxref{Conditional Constructs}). +testing part of the shell grammar (@pxref{Conditional Constructs}), including +optional regular expression matching. + +@item +Bash provides optional case-insensitive matching for the @code{case} and +@code{[[} constructs. @item Bash includes brace expansion (@pxref{Brace Expansion}) and tilde @@ -6901,6 +7019,10 @@ this unless the variables are explicitly marked using the @code{export} command. @item +Bash supports the @samp{+=} assignment operator, which appends to the value +of the variable named on the left hand side. + +@item Bash includes the @sc{posix} pattern removal @samp{%}, @samp{#}, @samp{%%} and @samp{##} expansions to remove leading or trailing substrings from variable values (@pxref{Shell Parameter Expansion}). @@ -6992,6 +7114,14 @@ operator, for directing standard output and standard error to the same file (@pxref{Redirections}). @item +Bash includes the @samp{<<<} redirection operator, allowing a string to +be used as the standard input to a command. + +@item +Bash implements the @samp{[n]<&@var{word}} and @samp{[n]>&@var{word}} +redirection operators, which move one file descriptor to another. + +@item Bash treats a number of filenames specially when they are used in redirection operators (@pxref{Redirections}). @@ -7126,7 +7256,9 @@ The @code{trap} builtin (@pxref{Bourne Shell Builtins}) allows a Commands specified with an @code{RETURN} trap are executed before execution resumes after a shell function or a shell script executed with @code{.} or @code{source} returns. -The @code{RETURN} trap is not inherited by shell functions. +The @code{RETURN} trap is not inherited by shell functions unless the +function has been given the @code{trace} attribute or the +@code{functrace} option has been enabled using the @code{shopt} builtin. @item The Bash @code{type} builtin is more extensive and gives more information @@ -7159,6 +7291,10 @@ of @code{SIGHUP} to a job when the shell exits as the result of a @code{SIGHUP}. @item +Bash includes a number of features to support a separate debugger for +shell scripts. + +@item The SVR4.2 shell has two privilege-related builtins (@code{mldmode} and @code{priv}) not present in Bash. diff --git a/doc/rose94.ps b/doc/rose94.ps new file mode 100644 index 0000000..1fff283 --- /dev/null +++ b/doc/rose94.ps @@ -0,0 +1,1581 @@ +%!PS-Adobe-3.0 +%%Creator: groff version 1.08 +%%DocumentNeededResources: font Times-Bold +%%+ font Times-Italic +%%+ font Times-Roman +%%+ font Courier +%%+ font Symbol +%%DocumentSuppliedResources: procset grops 1.08 0 +%%Pages: 13 +%%PageOrder: Ascend +%%Orientation: Portrait +%%EndComments +%%BeginProlog +%%BeginResource: procset grops 1.08 0 +/setpacking where{ +pop +currentpacking +true setpacking +}if +/grops 120 dict dup begin +/SC 32 def +/A/show load def +/B{0 SC 3 -1 roll widthshow}bind def +/C{0 exch ashow}bind def +/D{0 exch 0 SC 5 2 roll awidthshow}bind def +/E{0 rmoveto show}bind def +/F{0 rmoveto 0 SC 3 -1 roll widthshow}bind def +/G{0 rmoveto 0 exch ashow}bind def +/H{0 rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/I{0 exch rmoveto show}bind def +/J{0 exch rmoveto 0 SC 3 -1 roll widthshow}bind def +/K{0 exch rmoveto 0 exch ashow}bind def +/L{0 exch rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/M{rmoveto show}bind def +/N{rmoveto 0 SC 3 -1 roll widthshow}bind def +/O{rmoveto 0 exch ashow}bind def +/P{rmoveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/Q{moveto show}bind def +/R{moveto 0 SC 3 -1 roll widthshow}bind def +/S{moveto 0 exch ashow}bind def +/T{moveto 0 exch 0 SC 5 2 roll awidthshow}bind def +/SF{ +findfont exch +[exch dup 0 exch 0 exch neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/MF{ +findfont +[5 2 roll +0 3 1 roll +neg 0 0]makefont +dup setfont +[exch/setfont cvx]cvx bind def +}bind def +/level0 0 def +/RES 0 def +/PL 0 def +/LS 0 def +/PLG{ +gsave newpath clippath pathbbox grestore +exch pop add exch pop +}bind def +/BP{ +/level0 save def +1 setlinecap +1 setlinejoin +72 RES div dup scale +LS{ +90 rotate +}{ +0 PL translate +}ifelse +1 -1 scale +}bind def +/EP{ +level0 restore +showpage +}bind def +/DA{ +newpath arcn stroke +}bind def +/SN{ +transform +.25 sub exch .25 sub exch +round .25 add exch round .25 add exch +itransform +}bind def +/DL{ +SN +moveto +SN +lineto stroke +}bind def +/DC{ +newpath 0 360 arc closepath +}bind def +/TM matrix def +/DE{ +TM currentmatrix pop +translate scale newpath 0 0 .5 0 360 arc closepath +TM setmatrix +}bind def +/RC/rcurveto load def +/RL/rlineto load def +/ST/stroke load def +/MT/moveto load def +/CL/closepath load def +/FL{ +currentgray exch setgray fill setgray +}bind def +/BL/fill load def +/LW/setlinewidth load def +/RE{ +findfont +dup maxlength 1 index/FontName known not{1 add}if dict begin +{ +1 index/FID ne{def}{pop pop}ifelse +}forall +/Encoding exch def +dup/FontName exch def +currentdict end definefont pop +}bind def +/DEFS 0 def +/EBEGIN{ +moveto +DEFS begin +}bind def +/EEND/end load def +/CNT 0 def +/level1 0 def +/PBEGIN{ +/level1 save def +translate +div 3 1 roll div exch scale +neg exch neg exch translate +0 setgray +0 setlinecap +1 setlinewidth +0 setlinejoin +10 setmiterlimit +[]0 setdash +/setstrokeadjust where{ +pop +false setstrokeadjust +}if +/setoverprint where{ +pop +false setoverprint +}if +newpath +/CNT countdictstack def +userdict begin +/showpage{}def +}bind def +/PEND{ +clear +countdictstack CNT sub{end}repeat +level1 restore +}bind def +end def +/setpacking where{ +pop +setpacking +}if +%%EndResource +%%IncludeResource: font Times-Bold +%%IncludeResource: font Times-Italic +%%IncludeResource: font Times-Roman +%%IncludeResource: font Courier +%%IncludeResource: font Symbol +grops begin/DEFS 1 dict def DEFS begin/u{.001 mul}bind def end/RES 72 def/PL +792 def/LS false def/ENC0[/asciicircum/asciitilde/Scaron/Zcaron/scaron/zcaron +/Ydieresis/trademark/quotesingle/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef +/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/.notdef/space +/exclam/quotedbl/numbersign/dollar/percent/ampersand/quoteright/parenleft +/parenright/asterisk/plus/comma/hyphen/period/slash/zero/one/two/three/four +/five/six/seven/eight/nine/colon/semicolon/less/equal/greater/question/at/A/B/C +/D/E/F/G/H/I/J/K/L/M/N/O/P/Q/R/S/T/U/V/W/X/Y/Z/bracketleft/backslash +/bracketright/circumflex/underscore/quoteleft/a/b/c/d/e/f/g/h/i/j/k/l/m/n/o/p/q +/r/s/t/u/v/w/x/y/z/braceleft/bar/braceright/tilde/.notdef/quotesinglbase +/guillemotleft/guillemotright/bullet/florin/fraction/perthousand/dagger +/daggerdbl/endash/emdash/ff/fi/fl/ffi/ffl/dotlessi/dotlessj/grave/hungarumlaut +/dotaccent/breve/caron/ring/ogonek/quotedblleft/quotedblright/oe/lslash +/quotedblbase/OE/Lslash/.notdef/exclamdown/cent/sterling/currency/yen/brokenbar +/section/dieresis/copyright/ordfeminine/guilsinglleft/logicalnot/minus +/registered/macron/degree/plusminus/twosuperior/threesuperior/acute/mu +/paragraph/periodcentered/cedilla/onesuperior/ordmasculine/guilsinglright +/onequarter/onehalf/threequarters/questiondown/Agrave/Aacute/Acircumflex/Atilde +/Adieresis/Aring/AE/Ccedilla/Egrave/Eacute/Ecircumflex/Edieresis/Igrave/Iacute +/Icircumflex/Idieresis/Eth/Ntilde/Ograve/Oacute/Ocircumflex/Otilde/Odieresis +/multiply/Oslash/Ugrave/Uacute/Ucircumflex/Udieresis/Yacute/Thorn/germandbls +/agrave/aacute/acircumflex/atilde/adieresis/aring/ae/ccedilla/egrave/eacute +/ecircumflex/edieresis/igrave/iacute/icircumflex/idieresis/eth/ntilde/ograve +/oacute/ocircumflex/otilde/odieresis/divide/oslash/ugrave/uacute/ucircumflex +/udieresis/yacute/thorn/ydieresis]def/Courier@0 ENC0/Courier RE/Times-Roman@0 +ENC0/Times-Roman RE/Times-Italic@0 ENC0/Times-Italic RE/Times-Bold@0 ENC0 +/Times-Bold RE +%%EndProlog +%%Page: 1 1 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 12/Times-Bold@0 SF(Bash, the Bour)210.99 123 Q(ne\255Again Shell)-.18 E/F1 +10/Times-Italic@0 SF(Chet Rame)263.85 147 Q(y)-.3 E(Case W)221.72 159 Q +(estern Reserve Univer)-.92 E(sity)-.1 E -.15(ch)250.425 171 S(et@po.cwru.edu) +.15 E(ABSTRA)264.535 213 Q(CT)-.3 E/F2 10/Times-Roman@0 SF .019(An o)133 237 R +-.15(ve)-.15 G(rvie).15 E 2.519(wo)-.25 G 2.519(f/)191.918 237 S .018 +(bin/sh\255compatible shells is presented, as well as an introduction to) +200.547 237 R .128(the POSIX.2 shell and tools standard.)108 249 R .128 +(These serv)5.128 F 2.628(ea)-.15 G 2.628(sa)318.562 249 S 2.628(ni)329.52 249 +S .128(ntroduction to bash.)339.928 249 R 2.628(Ac)5.128 G(ompar)439.32 249 Q +(-)-.2 E .188(ison of bash to sh and ksh is presented, as well as a discussion\ + of features unique to bash.)108 261 R(Finally)108 273 Q 3.178(,s)-.65 G .678 +(ome of the changes and ne)145.258 273 R 3.178(wf)-.25 G .678 +(eatures to appear in the ne)268.486 273 R .678(xt bash release will be)-.15 F +(discussed.)108 285 Q/F3 10/Times-Bold@0 SF 2.5(1. Intr)72 321 R(oduction)-.18 +E(Bash)97 336.6 Q F2 .904(is the shell, or command language interpreter)3.404 F +3.404(,t)-.4 G .904(hat will appear in the GNU operating system.)316.032 336.6 +R .782(The name is an acron)72 348.6 R .782(ym for the `)-.15 F(`Bourne\255Ag) +-.74 E .782(ain SHell')-.05 F .782(', a pun on Ste)-.74 F 1.082 -.15(ve B)-.25 +H .783(ourne, the author of the direct).15 F .212(ancestor of the current)72 +360.6 R/F4 9/Times-Roman@0 SF(UNIX)2.712 E F2 2.712<8773>C(hell)199.131 360.6 Q +F1(/bin/sh)2.712 E F2 2.712(,w)C .212(hich appeared in the Se)256.505 360.6 R +-.15(ve)-.25 G .211(nth Edition Bell Labs Research v).15 F(er)-.15 E(-)-.2 E +(sion of)72 372.6 Q F4(UNIX)2.5 E F2([1].).833 E .191(Bash is an)97 388.2 R F3 +(sh)2.691 E F2 .192 +(\255compatible shell that incorporates useful features from the K)B .192 +(orn shell \()-.35 F F3(ksh)A F2 .833(\)[)C .192(2] and the)-.833 F 2.767(Cs)72 +400.2 S .267(hell \()85.327 400.2 R F3(csh)A F2 .833(\)[)C .267 +(3], described later in this article.)-.833 F .266 +(It is ultimately intended to be a conformant implementation)5.267 F 1.965 +(of the IEEE POSIX Shell and T)72 412.2 R 1.966(ools speci\214cation \(IEEE W) +-.8 F 1.966(orking Group 1003.2\).)-.8 F 1.966(It of)6.966 F 1.966 +(fers functional)-.25 F(impro)72 424.2 Q -.15(ve)-.15 G(ments o).15 E -.15(ve) +-.15 G 2.5(rs).15 G 2.5(hf)155.28 424.2 S(or both interacti)166.11 424.2 Q .3 +-.15(ve a)-.25 H(nd programming use.).15 E .802 +(While the GNU operating system will most lik)97 439.8 R .801(ely include a v) +-.1 F .801(ersion of the Berk)-.15 F(ele)-.1 E 3.301(ys)-.15 G .801 +(hell csh, bash)448.238 439.8 R .108(will be the def)72 451.8 R .108 +(ault shell.)-.1 F(Lik)5.108 E 2.608(eo)-.1 G .108(ther GNU softw)199.658 451.8 +R .108(are, bash is quite portable.)-.1 F .109(It currently runs on nearly e) +5.109 F -.15(ve)-.25 G(ry).15 E -.15(ve)72 463.8 S .367(rsion of).15 F F4(UNIX) +2.867 E F2 .367(and a fe)2.867 F 2.867(wo)-.25 G .367 +(ther operating systems \255 an independently-supported port e)187.933 463.8 R +.366(xists for OS/2, and)-.15 F .706(there are rumors of ports to DOS and W)72 +475.8 R(indo)-.4 E .706(ws NT)-.25 F 5.706(.P)-.74 G .706(orts to)295.97 475.8 +R F4(UNIX)3.206 E F2(-lik)A 3.206(es)-.1 G .706(ystems such as QNX and Minix) +372.979 475.8 R(are part of the distrib)72 487.8 Q(ution.)-.2 E .51 +(The original author of bash w)97 503.4 R .51(as Brian F)-.1 F .509 +(ox, an emplo)-.15 F .509(yee of the Free Softw)-.1 F .509(are F)-.1 F 3.009 +(oundation. The)-.15 F(cur)3.009 E(-)-.2 E(rent de)72 515.4 Q -.15(ve)-.25 G +(loper and maintainer is Chet Rame).15 E 1.3 -.65(y, a v)-.15 H(olunteer who w) +.45 E(orks at Case W)-.1 E(estern Reserv)-.8 E 2.5(eU)-.15 G(ni)458.91 515.4 Q +-.15(ve)-.25 G(rsity).15 E(.)-.65 E F3 2.5(2. What)72 539.4 R(is a shell?)2.5 E +F2 1.241(At its base, a shell is simply a macro processor that e)97 555 R -.15 +(xe)-.15 G 1.242(cutes commands.).15 F(A)6.242 E F4(UNIX)3.742 E F2 1.242 +(shell is both a)3.742 F .189(command interpreter)72 567 R 2.688(,w)-.4 G .188 +(hich pro)167.787 567 R .188(vides the user interf)-.15 F .188 +(ace to the rich set of)-.1 F F4(UNIX)2.688 E F2 .188 +(utilities, and a programming)2.688 F .751(language, allo)72 579 R .752 +(wing these utilitites to be combined.)-.25 F .752 +(The shell reads commands either from a terminal or a)5.752 F 2.52 +(\214le. Files)72 591 R .019 +(containing commands can be created, and become commands themselv)2.52 F 2.519 +(es. These)-.15 F(ne)2.519 E 2.519(wc)-.25 G(ommands)465.11 591 Q(ha)72 603 Q +.395 -.15(ve t)-.2 H .095(he same status as system commands in directories lik) +.15 F(e)-.1 E F3(/bin)2.595 E F2 2.595(,a)C(llo)342.575 603 Q .096 +(wing users or groups to establish cus-)-.25 F(tom en)72 615 Q(vironments.)-.4 +E F3 2.5(2.1. Command)72 639 R(Inter)2.5 E(pr)-.1 E(eter)-.18 E F2 2.926(As)97 +654.6 S .426(hell allo)111.036 654.6 R .426(ws e)-.25 F -.15(xe)-.15 G .426 +(cution of).15 F F4(UNIX)2.926 E F2 .426 +(commands, both synchronously and asynchronously)2.926 F 5.425(.T)-.65 G(he) +460.165 654.6 Q F1 -.37(re)2.925 G(dir).37 E(ec-)-.37 E(tion)72 666.6 Q F2 .334 +(constructs permit \214ne-grained control of the input and output of those com\ +mands, and the shell allo)2.833 F(ws)-.25 E .559(control o)72 678.6 R -.15(ve) +-.15 G 3.058(rt).15 G .558(he contents of their en)126.697 678.6 R(vironment.) +-.4 E F4(UNIX)5.558 E F2 .558(shells also pro)3.058 F .558 +(vide a small set of b)-.15 F .558(uilt-in commands)-.2 F(\()72 690.6 Q F1 -.2 +(bu)C(iltins).2 E F2 4.611(\)i)C 2.112 +(mplementing functionality impossible \(e.g.,)115.861 690.6 R F3(cd)4.612 E F2 +(,)A F3(br)4.612 E(eak)-.18 E F2(,)A F3(continue)4.612 E F2 4.612(,a)C(nd) +399.074 690.6 Q F3(exec)4.612 E F2 4.612(\)o)C 4.612(ri)444.948 690.6 S(ncon) +455.67 690.6 Q -.15(ve)-.4 G(nient).15 E .32 LW 76 700.6 72 700.6 DL 80 700.6 +76 700.6 DL 84 700.6 80 700.6 DL 88 700.6 84 700.6 DL 92 700.6 88 700.6 DL 96 +700.6 92 700.6 DL 100 700.6 96 700.6 DL 104 700.6 100 700.6 DL 108 700.6 104 +700.6 DL 112 700.6 108 700.6 DL 116 700.6 112 700.6 DL 120 700.6 116 700.6 DL +124 700.6 120 700.6 DL 128 700.6 124 700.6 DL 132 700.6 128 700.6 DL 136 700.6 +132 700.6 DL 140 700.6 136 700.6 DL 144 700.6 140 700.6 DL/F5 8/Times-Roman@0 +SF 2<8755>72 710.6 S(NIX is a trademark of X/OPEN)83.776 710.6 Q EP +%%Page: 2 2 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 2.5(-2-)279.67 48 S(\()72 84 Q/F1 10/Times-Bold@0 SF +(history)A F0(,)A F1(getopts)3.505 E F0(,)A F1(kill)3.505 E F0 3.505(,o)C(r) +172.795 84 Q F1(pwd)3.505 E F0 3.505(,f)C 1.005(or e)207.305 84 R 1.005 +(xample\) to obtain via separate utilities.)-.15 F 1.005 +(Shells may be used interac-)6.005 F(ti)72 96 Q -.15(ve)-.25 G +(ly or non-interacti).15 E -.15(ve)-.25 G 2.5(ly: the).15 F 2.5(ya)-.15 G +(ccept input typed from the k)207.42 96 Q -.15(ey)-.1 G +(board or from a \214le.).15 E F1 2.5(2.2. Pr)72 120 R(ogramming Language)-.18 +E F0 .501(While e)97 135.6 R -.15(xe)-.15 G .501 +(cuting commands is essential, most of the po).15 F .501(wer \(and comple)-.25 +F .502(xity\) of shells is due to their)-.15 F .05 +(embedded programming languages.)72 147.6 R(Lik)5.049 E 2.549(ea)-.1 G .349 +-.15(ny h)245.398 147.6 T(igh-le).15 E -.15(ve)-.25 G 2.549(ll).15 G .049 +(anguage, the shell pro)303.276 147.6 R .049(vides v)-.15 F .049 +(ariables, \215o)-.25 F 2.549(wc)-.25 G(ontrol)480.11 147.6 Q +(constructs, quoting, and functions.)72 159.6 Q .475 +(The basic syntactic element is a)97 175.2 R/F2 10/Times-Italic@0 SF .475 +(simple command)2.975 F F0 5.475(.A)C .475 +(simple command consists of an optional set of)315.405 175.2 R -.25(va)72 187.2 +S .525(riable assignments, a command w).25 F .525 +(ord, and an optional list of ar)-.1 F 3.024(guments. Operators)-.18 F .524 +(to redirect input and)3.024 F(output may appear an)72 199.2 Q +(ywhere in a simple command.)-.15 E(Some e)5 E(xamples are:)-.15 E/F3 10 +/Courier@0 SF(who)97 211.2 Q(trn -e -S1 -N)97 223.2 Q(ls -l /bin > binfiles)97 +235.2 Q(make > make.out 2>make.errs)97 247.2 Q F0 2.518(Ap)97 262.8 S .018 +(ipeline is a sequence of tw)111.738 262.8 R 2.518(oo)-.1 G 2.518(rm)230.056 +262.8 S .018(ore commands separated by the character)243.684 262.8 R/F4 10 +/Symbol SF<ef>2.519 E F0 5.019(.T)C .019(he standard output)430.082 262.8 R +(of the \214rst command is connected to the standard input of the second.)72 +274.8 Q(Examples of pipelines include:)5 E F3(who | wc -l)97 286.8 Q +(ls -l | sort +3nr)97 298.8 Q F0 .578 +(Simple commands and pipelines may be combined into)97 314.4 R F2(lists)3.078 E +F0 5.578(.A)C .578(list is a sequence of pipelines sepa-)360.002 314.4 R .289 +(rated by one of)72 326.4 R F1(;)2.789 E F0(,)A F1(&)2.789 E F0(,)A F1(&&)2.789 +E F0 2.789(,o)C(r)185.103 326.4 Q F4<efef>2.789 E F0 2.789(,a)C .289 +(nd optionally terminated by)210.831 326.4 R F1(;)2.789 E F0(,)A F1(&)2.789 E +F0 2.789(,o)C 2.789(ran)352.555 326.4 S -.25(ew)370.903 326.4 S 2.789 +(line. Commands).25 F .289(separated by)2.789 F F1(;)72 338.4 Q F0 .336(are e) +2.836 F -.15(xe)-.15 G .336(cuted sequentially; the shell w).15 F .335 +(aits for each to complete in turn.)-.1 F .335(If a command is terminated by) +5.335 F F1(&)2.835 E F0(,)A .007(the shell e)72 350.4 R -.15(xe)-.15 G .007 +(cutes it in the).15 F F2(bac)2.507 E(kgr)-.2 E(ound)-.45 E F0 2.508(,a)1.666 G +.008(nd does not w)236.076 350.4 R .008(ait for it to \214nish.)-.1 F .008 +(If tw)5.008 F 2.508(oc)-.1 G .008(ommands are separated by)397.616 350.4 R F1 +(&&)72 362.4 Q F0 3.008(,t)C .508(he second command e)96.948 362.4 R -.15(xe) +-.15 G .508(cutes only if the \214rst command succeeds.).15 F 3.007(As)5.508 G +.507(eparator of)383.575 362.4 R F4<efef>3.007 E F0 .507(causes the sec-)3.007 +F(ond command to e)72 374.4 Q -.15(xe)-.15 G(cute only if the \214rst f).15 E +2.5(ails. Some)-.1 F -.15(ex)2.5 G(amples are:).15 E F3(who ; date)97 386.4 Q +(cd /usr/src || exit 1)97 398.4 Q(cd "$@" && xtitle $HOST: $PWD)97 410.4 Q F0 +1.36(The shell programming language pro)97 426 R 1.361(vides a v)-.15 F 1.361 +(ariety of \215o)-.25 F 3.861(wc)-.25 G 1.361(ontrol structures.)353.276 426 R +(The)6.361 E F1 -.25(fo)3.861 G(r).25 E F0(command)3.861 E(allo)72 438 Q .654 +(ws a list of commands to be e)-.25 F -.15(xe)-.15 G .654 +(cuted once for each w).15 F .654(ord in a w)-.1 F .654(ord list.)-.1 F(The) +5.654 E F1(case)3.154 E F0 .654(command allo)3.154 F .654(ws a)-.25 F .627 +(list to be e)72 450 R -.15(xe)-.15 G .628(cuted if a w).15 F .628 +(ord matches a speci\214ed pattern.)-.1 F(The)5.628 E F1(while)3.128 E F0(and) +3.128 E F1(until)3.128 E F0 .628(commands e)3.128 F -.15(xe)-.15 G .628 +(cute a list of).15 F 1.559 +(commands as long as a guard command completes successfully or f)72 462 R 1.559 +(ails, respecti)-.1 F -.15(ve)-.25 G(ly).15 E 6.559(.T)-.65 G(he)440.892 462 Q +F1(if)4.059 E F0(command)4.059 E(allo)72 474 Q(ws e)-.25 E -.15(xe)-.15 G +(cution of dif).15 E(ferent command lists depending on the e)-.25 E +(xit status of a guard command.)-.15 E(A)97 489.6 Q F2 .385(shell function) +2.885 F F0 .385(associates a list of commands with a name.)2.885 F .386 +(Each time the name is used as a simple)5.385 F .938(command, the list is e)72 +501.6 R -.15(xe)-.15 G 3.438(cuted. This).15 F -.15(exe)3.438 G .938 +(cution tak).15 F .938(es place in the current shell conte)-.1 F .937 +(xt; no ne)-.15 F 3.437(wp)-.25 G .937(rocess is)468.903 501.6 R 2.5 +(created. Functions)72 513.6 R(may ha)2.5 E .3 -.15(ve t)-.2 H(heir o).15 E +(wn ar)-.25 E(gument lists and local v)-.18 E(ariables, and may be recursi)-.25 +E -.15(ve)-.25 G(.).15 E .722(The shell language pro)97 529.2 R .722(vides v) +-.15 F .722(ariables, which may be both set and referenced.)-.25 F 3.222(An) +5.722 G .722(umber of special)435.906 529.2 R 1.02 +(parameters are present, such as)72 541.2 R F1($@)3.519 E F0 3.519(,w)C 1.019 +(hich returns the shell')231.257 541.2 R 3.519(sp)-.55 G 1.019 +(ositional parameters \(command-line ar)333.103 541.2 R(gu-)-.18 E(ments\),)72 +553.2 Q F1($?)2.906 E F0 2.906(,t)C .406(he e)122.812 553.2 R .406 +(xit status of the pre)-.15 F .406(vious command, and)-.25 F F1($$)2.906 E F0 +2.906(,t)C .406(he shell')322.436 553.2 R 2.906(sp)-.55 G .406(rocess I.D.) +368.248 553.2 R .407(In addition to pro)5.406 F(vid-)-.15 E .129 +(ing special parameters and user)72 565.2 R .129(-de\214ned v)-.2 F .129 +(ariables, the shell permits the v)-.25 F .128(alues of certain v)-.25 F .128 +(ariables to control)-.25 F .16(its beha)72 577.2 R(vior)-.2 E 5.16(.S)-.55 G +.16(ome of these v)131.57 577.2 R .16(ariables include)-.25 F F1(IFS)2.661 E F0 +2.661(,w)C .161(hich controls ho)284.202 577.2 R 2.661(wt)-.25 G .161 +(he shell splits w)361.375 577.2 R(ords,)-.1 E F1 -.74(PA)2.661 G(TH)-.21 E F0 +2.661(,w)C(hich)486.78 577.2 Q .392 +(tells the shell where to look for commands, and)72 589.2 R F1(PS1)2.892 E F0 +2.892(,w)C .392(hose v)297.01 589.2 R .392 +(alue is the string the shell uses to prompt for)-.25 F 3.371(commands. There) +72 601.2 R .871(are a fe)3.371 F 3.371(wv)-.25 G .871(ariables whose v)196.645 +601.2 R .871(alues are set by the shell and normally only referenced by)-.25 F +(users;)72 613.2 Q F1(PWD)3.663 E F0 3.663(,w)C 1.163(hose v)135.706 613.2 R +1.163(alue is the pathname of the shell')-.25 F 3.662(sc)-.55 G 1.162(urrent w) +313.068 613.2 R 1.162(orking directory)-.1 F 3.662(,i)-.65 G 3.662(so)421.894 +613.2 S 1.162(ne such v)434.446 613.2 R(ariable.)-.25 E -1.11(Va)72 625.2 S +.008(riables can be used in nearly an)1.11 F 2.509(ys)-.15 G .009(hell conte) +219.37 625.2 R .009(xt and are particularly v)-.15 F .009 +(aluable when used with control struc-)-.25 F(tures.)72 637.2 Q .583 +(There are se)97 652.8 R -.15(ve)-.25 G .583(ral shell).15 F F2 -.2(ex)3.083 G +(pansions).2 E F0 5.583(.A)C -.25(va)254.298 652.8 S(riable).25 E F2(name)3.083 +E F0 .583(is e)3.083 F .582(xpanded to its v)-.15 F .582(alue using ${)-.25 F +F2(name)A F0 .582(}, where)B 1.387(the braces are optional.)72 664.8 R 1.387 +(There are a number of parameter e)6.387 F 1.388(xpansions a)-.15 F -.25(va)-.2 +G 3.888(ilable. F).25 F 1.388(or e)-.15 F 1.388(xample, there are)-.15 F(${)72 +676.8 Q F2(name)A F0<3aad>A F2(wor)A(d)-.37 E F0 .891(}, which e)B .891 +(xpands to)-.15 F F2(wor)3.391 E(d)-.37 E F0(if)3.391 E F2(name)3.391 E F0 .891 +(is unset or null, and the in)3.391 F -.15(ve)-.4 G .89(rse ${).15 F F2(name)A +F0(:+)A F2(wor)A(d)-.37 E F0 .89(}, which)B -.15(ex)72 688.8 S 1.203(pands to) +.15 F F2(wor)3.703 E(d)-.37 E F0(if)3.703 E F2(name)3.703 E F0 1.203 +(is set and not null.)3.703 F F2 1.203(Command substitution)6.203 F F0(allo) +3.703 E 1.204(ws the output of a command to)-.25 F .918 +(replace the command name.)72 700.8 R .918(The syntax is `)5.918 F F2(command)A +F0(`.)A F2(Command)5.918 E F0 .918(is e)3.418 F -.15(xe)-.15 G .918 +(cuted and it and the backquotes).15 F .299 +(are replaced by its output, with trailing ne)72 712.8 R .299(wlines remo)-.25 +F -.15(ve)-.15 G(d.).15 E F2 -.8(Pa)5.299 G .299(thname e).8 F(xpansion)-.2 E +F0 .299(is a w)2.799 F .299(ay to e)-.1 F .299(xpand a w)-.15 F(ord)-.1 E 1.586 +(to a set of \214lenames.)72 724.8 R -.8(Wo)6.586 G 1.586(rds are re).8 F -.05 +(ga)-.15 G 1.586(rded as patterns, in which the characters).05 F F1(*)4.086 E +F0(,)A F1(?)4.086 E F0 4.085(,a)C(nd)432.115 724.8 Q F1([)4.085 E F0(ha)4.085 E +1.885 -.15(ve s)-.2 H(pecial).15 E EP +%%Page: 3 3 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 2.5(-3-)279.67 48 S 2.845(meaning. W)72 84 R .346(ords\ + containing these special characters are replaced with a sorted list of matchi\ +ng pathnames.)-.8 F(If a w)72 96 Q +(ord generates no matches, it is left unchanged.)-.1 E/F1 10/Times-Italic@0 SF +(Quoting)97 111.6 Q F0 .85(is used to remo)3.35 F 1.15 -.15(ve t)-.15 H .85 +(he special meaning of characters or w).15 F 3.35(ords. It)-.1 F .85 +(can disable special treat-)3.35 F .314 +(ment for shell operators or other special characters, pre)72 123.6 R -.15(ve) +-.25 G .315(nt reserv).15 F .315(ed w)-.15 F .315 +(ords from being recognized as such,)-.1 F .683(and inhibit v)72 135.6 R .683 +(ariable e)-.25 F 3.183(xpansion. The)-.15 F .683 +(shell has three quoting mechanisms:)3.183 F 3.183(ab)5.683 G .683 +(ackslash preserv)387.413 135.6 R .682(es the literal)-.15 F -.25(va)72 147.6 S +.417(lue of the ne).25 F .417(xt character)-.15 F 2.917(,ap)-.4 G .417 +(air of single quotes preserv)196.712 147.6 R .417(es the literal v)-.15 F .418 +(alue of each character between the)-.25 F 1.426 +(quotes, and a pair of double quotes preserv)72 159.6 R 1.425 +(es the literal meaning of enclosed characters while allo)-.15 F(wing)-.25 E +(some e)72 171.6 Q(xpansions.)-.15 E 1.054(Some of the commands b)97 187.2 R +1.054(uilt into the shell are part of the programming language.)-.2 F(The)6.055 +E/F2 10/Times-Bold@0 SF(br)3.555 E(eak)-.18 E F0(and)3.555 E F2(continue)72 +199.2 Q F0 1.175(commands control loop e)3.675 F -.15(xe)-.15 G 1.175 +(cution as in the C language.).15 F(The)6.175 E F2 -2.3 -.15(ev a)3.675 H(l).15 +E F0 -.2(bu)3.675 G 1.174(iltin allo).2 F 1.174(ws a string to be)-.25 F .204 +(parsed and e)72 211.2 R -.15(xe)-.15 G .204(cuted as a command.).15 F F2 -.65 +(Wa)5.205 G(it).65 E F0 .205 +(tells the shell to pause until the processes speci\214ed as ar)2.705 F +(guments)-.18 E(ha)72 223.2 Q .3 -.15(ve ex)-.2 H(ited.).15 E F2 2.5 +(2.3. Interacti)72 247.2 R .2 -.1(ve F)-.1 H(eatur)-.15 E(es)-.18 E F0 .51 +(Shells ha)97 262.8 R .81 -.15(ve b)-.2 H -.15(eg).15 G .51(un of).15 F .51 +(fering features geared speci\214cally for interacti)-.25 F .81 -.15(ve u)-.25 +H .51(se rather than to augment the).15 F .76(programming language.)72 274.8 R +.761(These interacti)5.76 F 1.061 -.15(ve f)-.25 H .761 +(eatures include job control, command line editing, history and).15 F(aliases.) +72 286.8 Q .626(Job control is a f)97 302.4 R .626(acility pro)-.1 F .626 +(vided jointly by the shell and the)-.15 F/F3 9/Times-Roman@0 SF(UNIX)3.125 E +F0 -.1(ke)3.125 G .625(rnel that allo).1 F .625(ws users to selec-)-.25 F(ti)72 +314.4 Q -.15(ve)-.25 G .344 +(ly stop \(suspend\) and restart \(resume\) processes.).15 F .345 +(Each pipeline e)5.345 F -.15(xe)-.15 G .345 +(cuted by the shell is referred to as a).15 F F1(job)72 326.4 Q F0 2.989(.J)C +.488(obs may be suspended and restarted in either the fore)94.159 326.4 R .488 +(ground, where the)-.15 F 2.988(yh)-.15 G -2.25 -.2(av e)397.148 326.4 T .488 +(access to the terminal,)3.188 F .833(or background, where the)72 338.4 R 3.333 +(ya)-.15 G .834(re isolated and cannot read from the terminal.)189.312 338.4 R +-.8(Ty)5.834 G .834(ping the).8 F F1(suspend)3.334 E F0(character)5 E .459(whi\ +le a process is running stops that process and returns control to the shell.)72 +350.4 R .459(Once a job is suspended, the)5.459 F .392 +(user manipulates the job')72 362.4 R 2.892(ss)-.55 G .392(tate, using)184.118 +362.4 R F2(bg)2.892 E F0 .393(to continue it in the background,)2.892 F F2(fg) +2.893 E F0 .393(to return it to the fore)2.893 F(ground)-.15 E .891(and a)72 +374.4 R -.1(wa)-.15 G .891(it its completion, or).1 F F2(kill)3.391 E F0 .891 +(to send it a signal.)3.391 F(The)5.89 E F2(jobs)3.39 E F0 .89 +(command lists the status of jobs, and)3.39 F F2(wait)3.39 E F0 .407 +(will pause the shell until a speci\214ed job terminates.)72 386.4 R .407 +(The shell pro)5.407 F .407(vides a number of w)-.15 F .407 +(ays to refer to a job,)-.1 F(and will notify the user whene)72 398.4 Q -.15 +(ve)-.25 G 2.5(rab).15 G(ackground job terminates.)220.18 398.4 Q -.4(Wi)97 414 +S .956(th the adv).4 F .956(ent of more po)-.15 F .956 +(werful terminals and terminal emulators, more sophisticated interaction)-.25 F +.253(than that pro)72 426 R .253(vided by the)-.15 F F3(UNIX)2.753 E F0 -.1(ke) +2.754 G .254(rnel terminal dri).1 F -.15(ve)-.25 G 2.754(ri).15 G 2.754(sp) +293.592 426 S 2.754(ossible. Some)305.236 426 R .254(shells of)2.754 F .254 +(fer command line editing,)-.25 F 1.141 +(which permits a user to edit lines of input using f)72 438 R(amiliar)-.1 E F1 +(emacs)3.64 E F0(or)3.64 E F1(vi)3.64 E F0 1.14 +(-style commands before submitting)B .02(them to the shell.)72 450 R .02 +(Editors allo)5.02 F 2.52(wc)-.25 G .02(orrections to be made without ha)206.31 +450 R .021(ving to erase back to the point of error)-.2 F 2.521(,o)-.4 G(r) +500.67 450 Q .135(start the line ane)72 462 R 3.935 -.65(w. C)-.25 H .135 +(ommand line editors run the g).65 F .135(amut from a small \214x)-.05 F .134 +(ed set of commands and k)-.15 F .434 -.15(ey b)-.1 H(ind-).15 E +(ings to input f)72 474 Q(acilities which allo)-.1 E 2.5(wa)-.25 G +(rbitrary actions to be bound to a k)217.2 474 Q .3 -.15(ey o)-.1 H 2.5(rk).15 +G .3 -.15(ey s)379.88 474 T(equence.).15 E .145(Modern shells also k)97 489.6 R +.145(eep a history)-.1 F 2.645(,w)-.65 G .146 +(hich is the list of commands a user has typed.)243.49 489.6 R .146(Shell f) +5.146 F .146(acilities are)-.1 F -.2(av)72 501.6 S .368(ailable to recall pre) +-.05 F .367(vious commands and use portions of old commands when composing ne) +-.25 F 2.867(wo)-.25 G 2.867(nes. The)467.253 501.6 R 1.456 +(command history can be sa)72 513.6 R -.15(ve)-.2 G 3.957(dt).15 G 3.957 +(oa\214)207.522 513.6 S 1.457 +(le and read back in at shell startup, so it persists across sessions.)230.436 +513.6 R .675(Shells which pro)72 525.6 R .675 +(vide both command editing and history generally ha)-.15 F .974 -.15(ve e)-.2 H +.674(diting commands to interacti).15 F -.15(ve)-.25 G(ly).15 E(step forw)72 +537.6 Q(ard and backw)-.1 E(ard through the history list.)-.1 E .013 +(Aliases allo)97 553.2 R -5.012 2.513(wa s)-.25 H .014 +(tring to be substituted for a command name.)164.28 553.2 R(The)5.014 E 2.514 +(yc)-.15 G .014(an be used to create a mnemonic)373.396 553.2 R .568(for a)72 +565.2 R F3(UNIX)3.068 E F0 .568(command name \()3.068 F/F4 10/Courier@0 SF .568 +(alias del=rm)B F0 .568(\), to e)B .567(xpand a single w)-.15 F .567 +(ord to a comple)-.1 F 3.067(xc)-.15 G .567(ommand \()432.603 565.2 R F4(alias) +A .255(news='xterm -g 80x45 -title trn -e trn -e -S1 -N &')72 577.2 R F0 .255 +(\), or to ensure that a command)B(is in)72 589.2 Q -.2(vo)-.4 G -.1(ke).2 G +2.5(dw).1 G(ith a basic set of options \()122.41 589.2 Q F4 +(alias ls="/bin/ls -F")A F0(\).)A F2 2.5(3. The)72 613.2 R +(POSIX Shell Standard)2.5 E F1(POSIX)97 628.8 Q F0 .239 +(is a name originally coined by Richard Stallman for a f)4.405 F .239 +(amily of open system standards based)-.1 F(on)72 640.8 Q F3(UNIX)3.239 E F0 +5.739(.T)C .74(here are a number of aspects of)122.079 640.8 R F3(UNIX)3.24 E +F0 .74(under consideration for standardization, from the basic)3.24 F .192 +(system services at the system call and C library le)72 652.8 R -.15(ve)-.25 G +2.692(lt).15 G 2.692(oa)290.16 652.8 S .191 +(pplications and tools to system administration and)302.292 652.8 R 2.5 +(management. Each)72 664.8 R(area of standardization is assigned to a w)2.5 E +(orking group in the 1003 series.)-.1 E 3.602(The POSIX Shell and T)97 680.4 R +3.602(ools standard has been de)-.8 F -.15(ve)-.25 G 3.603(loped by IEEE W).15 +F 3.603(orking Group 1003.2)-.8 F -1.667(\(POSIX.2\) [4].)72 692.4 R 2.799 +(It concentrates on the command interpreter interf)7.799 F 2.799 +(ace and utility programs commonly)-.1 F -.15(exe)72 704.4 S 2.345 +(cuted from the command line or by other programs.).15 F 2.345(An initial v) +7.345 F 2.345(ersion of the standard has been)-.15 F(appro)72 716.4 Q -.15(ve) +-.15 G 2.915(da).15 G .414(nd published by the IEEE, and w)116.265 716.4 R .414 +(ork is currently underw)-.1 F .414(ay to update it.)-.1 F .414 +(There are four primary)5.414 F(areas of w)72 728.4 Q +(ork in the 1003.2 standard:)-.1 E EP +%%Page: 4 4 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 2.5(-4-)279.67 48 S 21.5<8341>72 84 S .835 +(spects of the shell')104.22 84 R 3.335(ss)-.55 G .835 +(yntax and command language.)192 84 R 3.335(An)5.835 G .835(umber of special b) +338.095 84 R .835(uiltins such as)-.2 F/F1 10/Times-Bold@0 SF(cd)3.335 E F0 +(and)3.335 E F1(exec)97 96 Q F0 .545(are being speci\214ed as part of the shel\ +l, since their functionality usually cannot be implemented)3.046 F +(by a separate e)97 108 Q -.15(xe)-.15 G(cutable;).15 E 21.5<8341>72 123.6 S +.73(set of utilities to be called by shell scripts and applications.)107.45 +123.6 R .731(Examples are programs lik)5.731 F(e)-.1 E/F2 10/Times-Italic@0 SF +2.397(sed, tr)3.231 F(,)-1.11 E F0(and)97 135.6 Q F2(awk.)2.853 E F0 .352 +(Utilities commonly implemented as shell b)4.519 F .352 +(uiltins are described in this section, such as)-.2 F F1(test)2.852 E F0(and)97 +147.6 Q F1(kill)3.422 E F0 5.922(.A)C 3.422(ne)144.404 147.6 S .922 +(xpansion of this section')157.116 147.6 R 3.423(ss)-.55 G .923 +(cope, termed the User Portability Extension, or UPE, has)268.586 147.6 R +(standardized interacti)97 159.6 Q .3 -.15(ve p)-.25 H(rograms such as).15 E F2 +(vi)2.5 E F0(and)4.166 E F2(mailx;)2.5 E F0 21.5<8341>72 175.2 S .926 +(group of functional interf)107.646 175.2 R .926(aces to services pro)-.1 F +.926(vided by the shell, such as the traditional)-.15 F F2(system)3.425 E F0(C) +5.091 E .507(library function.)97 187.2 R .507 +(There are functions to perform shell w)5.507 F .508(ord e)-.1 F .508 +(xpansions, perform \214lename e)-.15 F(xpansion)-.15 E(\()97 199.2 Q F2 +(globbing)A F0 .58(\), obtain v)B .58 +(alues of POSIX.2 system con\214guration v)-.25 F .58(ariables, retrie)-.25 F +.88 -.15(ve v)-.25 H .58(alues of en)-.1 F(vironment)-.4 E -.25(va)97 211.2 S +(riables \().25 E F2 -.1(ge)C(ten).1 E(v\(\))-.4 E F0(\), and other services;) +.833 E 21.5<8341>72 226.8 S(suite of `)106.72 226.8 Q(`de)-.74 E -.15(ve)-.25 G +(lopment').15 E 2.5('u)-.74 G(tilities such as)209.54 226.8 Q F2(c89)2.5 E F0 +(\(the POSIX.2 v)4.166 E(ersion of)-.15 E F2(cc)2.5 E F0(\), and)A F2(yacc.)2.5 +E F0 .483(Bash is concerned with the aspects of the shell')97 242.4 R 2.983(sb) +-.55 G(eha)301.597 242.4 Q .484(vior de\214ned by POSIX.2.)-.2 F .484 +(The shell command)5.484 F 1.439 +(language has of course been standardized, including the basic \215o)72 254.4 R +3.938(wc)-.25 G 1.438(ontrol and program e)359.688 254.4 R -.15(xe)-.15 G 1.438 +(cution con-).15 F 1.145(structs, I/O redirection and pipelining, ar)72 266.4 R +1.145(gument handling, v)-.18 F 1.145(ariable e)-.25 F 1.146 +(xpansion, and quoting.)-.15 F(The)6.146 E F2(special)3.646 E F0 -.2(bu)72 +278.4 S .676(iltins, which must be implemented as part of the shell to pro).2 F +.676(vide the desired functionality)-.15 F 3.176(,a)-.65 G .676(re speci\214ed) +457.504 278.4 R .7(as being part of the shell; e)72 290.4 R .7 +(xamples of these are)-.15 F F1 -2.3 -.15(ev a)3.201 H(l).15 E F0(and)3.201 E +F1(export)3.201 E F0 5.701(.O)C .701(ther utilities appear in the sections of) +352.034 290.4 R .256(POSIX.2 not de)72 302.4 R -.2(vo)-.25 G .256(ted to the s\ +hell which are commonly \(and in some cases must be\) implemented as b).2 F +(uiltin)-.2 E(commands, such as)72 314.4 Q F1 -.18(re)2.5 G(ad).18 E F0(and)2.5 +E F1(test)2.5 E F0(.)A .972(POSIX.2 also speci\214es aspects of the shell')97 +330 R 3.473(si)-.55 G(nteracti)286.016 330 Q 1.273 -.15(ve b)-.25 H(eha).15 E +.973(vior as part of the UPE, including job)-.2 F .233 +(control, command line editing, and history)72 342 R 5.233(.I)-.65 G .233 +(nterestingly enough, only)253.849 342 R F2(vi)2.733 E F0 .233 +(-style line editing commands ha)B -.15(ve)-.2 G(been standardized;)72 354 Q F2 +(emacs)2.5 E F0(editing commands were left out due to objections.)2.5 E .148 +(There were certain areas in which POSIX.2 felt standardization w)97 369.6 R +.149(as necessary)-.1 F 2.649(,b)-.65 G .149(ut no e)420.643 369.6 R .149 +(xisting imple-)-.15 F 1.598(mentation pro)72 381.6 R 1.598 +(vided the proper beha)-.15 F(vior)-.2 E 6.598(.T)-.55 G 1.598(he w)251.56 +381.6 R 1.597(orking group in)-.1 F -.15(ve)-.4 G 1.597 +(nted and standardized functionality in).15 F .228(these areas.)72 393.6 R(The) +5.228 E F1(command)2.728 E F0 -.2(bu)2.728 G .228(iltin w).2 F .228(as in)-.1 F +-.15(ve)-.4 G .228(nted so that shell functions could be written to replace b) +.15 F(uiltins;)-.2 E 1.663(it mak)72 405.6 R 1.663 +(es the capabilities of the b)-.1 F 1.663(uiltin a)-.2 F -.25(va)-.2 G 1.663 +(ilable to the function.).25 F 1.663(The reserv)6.663 F 1.663(ed w)-.15 F 1.663 +(ord `)-.1 F(`!')-.74 E 4.163('w)-.74 G 1.663(as added to)455.685 405.6 R(ne)72 +417.6 Q -.05(ga)-.15 G .915(te the return v).05 F .915 +(alue of a command or pipeline; it w)-.25 F .916(as nearly impossible to e)-.1 +F .916(xpress `)-.15 F .916(`if not x')-.74 F 3.416('c)-.74 G(leanly)479.56 +417.6 Q .904(using the sh language.)72 429.6 R .904(There e)5.904 F .904 +(xist multiple incompatible implementations of the)-.15 F F1(test)3.403 E F0 +-.2(bu)3.403 G .903(iltin, which tests).2 F .28 +(\214les for type and other attrib)72 441.6 R .281 +(utes and performs arithmetic and string comparisons.)-.2 F .281 +(POSIX considered none)5.281 F .868(of these correct, so the standard beha)72 +453.6 R .868(vior w)-.2 F .868(as speci\214ed in terms of the number of ar)-.1 +F .867(guments to the com-)-.18 F 3.803(mand. POSIX.2)72 465.6 R 1.303 +(dictates e)3.803 F 1.303(xactly what will happen when four or fe)-.15 F 1.303 +(wer ar)-.25 F 1.303(guments are gi)-.18 F -.15(ve)-.25 G 3.803(nt).15 G(o) +459.462 465.6 Q F1(test)3.804 E F0 3.804(,a)C(nd)494 465.6 Q(lea)72 477.6 Q +-.15(ve)-.2 G 4.531(st).15 G 2.031(he beha)103.951 477.6 R 2.031 +(vior unde\214ned when more ar)-.2 F 2.031(guments are supplied.)-.18 F 2.03 +(Bash uses the POSIX.2 algorithm,)7.031 F(which w)72 489.6 Q(as concei)-.1 E +-.15(ve)-.25 G 2.5(db).15 G 2.5(yD)164.53 489.6 S -.2(av)179.25 489.6 S(id K).2 +E(orn.)-.35 E 1.128 +(While POSIX.2 includes much of what the shell has traditionally pro)97 505.2 R +1.129(vided, some important things)-.15 F(ha)72 517.2 Q .58 -.15(ve b)-.2 H .28 +(een omitted as being `).15 F(`be)-.74 E .28(yond its scope.)-.15 F 4.26 -.74 +('' T)-.7 H .28(here is, for instance, no mention of a dif).74 F .28 +(ference between)-.25 F(a)72 529.2 Q F2(lo)3.354 E(gin)-.1 E F0 .854 +(shell and an)5.02 F 3.354(yo)-.15 G .854(ther interacti)167.956 529.2 R 1.154 +-.15(ve s)-.25 H .854(hell \(since POSIX.2 does not specify a login program\).) +.15 F .855(No \214x)5.855 F(ed)-.15 E +(startup \214les are de\214ned, either \255 the standard does not mention)72 +541.2 Q F2(.pr)2.5 E(o\214le)-.45 E F0(.)1.666 E F1 2.5(4. Shell)72 565.2 R +(Comparison)2.5 E F0 .693(This section compares features of bash, sh, and ksh \ +\(the three shells closest to POSIX compliance\).)97 580.8 R .245(Since ksh an\ +d bash are supersets of sh, the features common to all three are co)72 592.8 R +-.15(ve)-.15 G .245(red \214rst.).15 F .245(Some of the fea-)5.245 F 1.198 +(tures bash and ksh contain which are not in sh will be discussed.)72 604.8 R +(Ne)6.198 E 1.198(xt, features unique to bash will be)-.15 F 2.866(listed. The) +72 616.8 R .366(\214rst three sections pro)2.866 F .366(vide a progressi)-.15 F +-.15(ve)-.25 G .366(ly more detailed o).15 F -.15(ve)-.15 G(rvie).15 E 2.866 +(wo)-.25 G 2.866(fb)395.706 616.8 S 2.866(ash. Finally)406.902 616.8 R 2.866 +(,f)-.65 G .366(eatures of)464.484 616.8 R(ksh-88 \(the currently-a)72 628.8 Q +-.25(va)-.2 G(ilable v).25 E(ersion\) not in sh or bash will be presented.)-.15 +E F1 2.5(4.1. Common)72 652.8 R -.25(Fe)2.5 G(atur).25 E(es)-.18 E F0 .021 +(All three shells ha)97 668.4 R .321 -.15(ve t)-.2 H .021 +(he same basic feature set, which is essentially that pro).15 F .02 +(vided by sh and described)-.15 F 1.026(in an)72 680.4 R 3.526(ys)-.15 G 3.526 +(hm)105.012 680.4 S 1.027 +(anual page. Bash and ksh are both sh supersets, and so all three pro)121.318 +680.4 R 1.027(vide the command inter)-.15 F(-)-.2 E .714 +(preter and programming language described earlier)72 692.4 R 3.214(.T)-.55 G +.714(he shell grammar)291.506 692.4 R 3.214(,s)-.4 G .714(yntax, \215o)371.568 +692.4 R 3.214(wc)-.25 G .714(ontrol, redirections,)424.686 692.4 R(and b)72 +704.4 Q(uiltins implemented by the Bourne shell are the baseline for subsequen\ +t discussion.)-.2 E EP +%%Page: 5 5 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 2.5(-5-)279.67 48 S/F1 10/Times-Bold@0 SF 2.5(4.2. F)72 +84 R(eatur)-.25 E(es in bash and ksh)-.18 E F0 .458(Ksh and bash ha)97 99.6 R +.758 -.15(ve s)-.2 H -2.15 -.25(ev e).15 H .459(ral features in common be).25 F +.459(yond this base le)-.15 F -.15(ve)-.25 G 2.959(lo).15 G 2.959(ff)387.814 +99.6 S(unctionality)397.433 99.6 Q 5.459(.S)-.65 G .459(ome of this)458.082 +99.6 R(is due to the POSIX.2 standard.)72 111.6 Q(Other functions ha)5 E .3 +-.15(ve b)-.2 H(een implemented in bash using ksh as a guide.).15 E F1 2.5 +(4.2.1. V)72 135.6 R(ariables and V)-.92 E(ariable Expansion)-.92 E F0 .097 +(Bash and ksh ha)97 151.2 R .396 -.15(ve a)-.2 H .096(ugmented v).15 F .096 +(ariable e)-.25 F 2.596(xpansion. Arithmetic)-.15 F .096(substitution allo) +2.596 F .096(ws an e)-.25 F .096(xpression to be)-.15 F -.25(eva)72 163.2 S .6 +(luated and the result substituted.).25 F .6(Shell v)5.6 F .6 +(ariables may be used as operands, and the result of an e)-.25 F(xpres-)-.15 E +.41(sion may be assigned to a v)72 175.2 R 2.91(ariable. Nearly)-.25 F .41 +(all of the operators from the C language are a)2.91 F -.25(va)-.2 G .41 +(ilable, with the).25 F(same precedence rules:)72 187.2 Q/F2 10/Courier@0 SF 6 +($e)97 205.2 S(cho $\(\(3 + 5 * 32\)\))115 205.2 Q(163)97 217.2 Q F0 -1.11(Va) +72 238.8 S 1.445(riables may be declared as)1.11 F/F3 10/Times-Italic@0 SF +(inte)3.945 E -.1(ge)-.4 G(r).1 E F0 3.945(,w)1.666 G 1.446 +(hich causes arithmetic e)240.956 238.8 R -.25(va)-.25 G 1.446 +(luation to be performed on the v).25 F(alue)-.25 E(whene)72 250.8 Q -.15(ve) +-.25 G 2.5(rt).15 G(he)115.75 250.8 Q 2.5(ya)-.15 G(re assigned to.)136.98 +250.8 Q .483(There are ne)97 266.4 R 2.983(we)-.25 G .483 +(xpansions to obtain the length of a v)162.179 266.4 R(ariable')-.25 E 2.982 +(sv)-.55 G .482(alue and to remo)352.19 266.4 R .782 -.15(ve s)-.15 H .482 +(ubstrings match-).15 F .063(ing speci\214ed patterns from the be)72 278.4 R +.063(ginning and end of v)-.15 F .063(ariable v)-.25 F 2.563(alues. A)-.25 F +(ne)2.563 E 2.563(wf)-.25 G .064(orm of command substitution,)383.249 278.4 R +F1($\()72 290.4 Q F3(list)A F1(\))A F0 2.5(,i)C 2.5(sm)103.67 290.4 S +(uch easier to nest than `)117.84 290.4 Q F3(list)A F0 2.5(`a)C +(nd has simpli\214ed quoting rules.)235.04 290.4 Q .082(There are ne)97 306 R +2.582(wv)-.25 G .082(ariables to control the shell')161.436 306 R 2.581(sb)-.55 +G(eha)284.333 306 Q(vior)-.2 E 2.581(,a)-.4 G .081(nd additional v)323.244 306 +R .081(ariables set or interpreted spe-)-.25 F 1.038(cially by the shell.)72 +318 R F1(RANDOM)6.038 E F0(and)3.538 E F1(SECONDS)3.538 E F0(are)3.539 E F3 +(dynamic)3.539 E F0 -.25(va)3.539 G 3.539(riables: their).25 F -.25(va)3.539 G +1.039(lues are generated afresh).25 F 1.022(each time the)72 330 R 3.522(ya) +-.15 G 1.022(re referenced.)140.176 330 R F1(RANDOM)6.022 E F0 1.021 +(returns a dif)3.521 F 1.021(ferent random number each time it is referenced,) +-.25 F(and)72 342 Q F1(SECONDS)3.138 E F0 .638 +(returns the number of seconds since the shell w)3.138 F .638 +(as started or the v)-.1 F .639(ariable w)-.25 F .639(as assigned to,)-.1 F +1.448(plus an)72 354 R 3.948(yv)-.15 G 1.448(alue assigned.)115.606 354 R F1 +(PWD)6.448 E F0(and)3.948 E F1(OLDPWD)3.947 E F0 1.447 +(are set to the current and pre)3.947 F 1.447(vious w)-.25 F 1.447 +(orking directories,)-.1 F(respecti)72 366 Q -.15(ve)-.25 G(ly).15 E(.)-.65 E +F1(TMOUT)5.604 E F0 .604(controls ho)3.104 F 3.104(wl)-.25 G .604 +(ong the shell will w)226.436 366 R .604(ait at a prompt for input.)-.1 F(If) +5.604 E F1(TMOUT)3.104 E F0 .605(is set to a)3.105 F -.25(va)72 378 S 1.168 +(lue greater than zero, the shell e).25 F 1.168(xits after w)-.15 F 1.168 +(aiting that man)-.1 F 3.668(ys)-.15 G 1.167(econds for input.)337.478 378 R F1 +(REPL)6.167 E(Y)-.92 E F0 1.167(is the def)3.667 F(ault)-.1 E -.25(va)72 390 S +.991(riable for the).25 F F1 -.18(re)3.491 G(ad).18 E F0 -.2(bu)3.491 G .991 +(iltin; if no v).2 F .992(ariable names are supplied as ar)-.25 F .992 +(guments, the line read is assigned to)-.18 F F1(REPL)72 402 Q(Y)-.92 E F0(.)A +F1 2.5(4.2.2. New)72 426 R(and Modi\214ed Builtins)2.5 E F0 .652(Both shells e) +97 441.6 R .651(xpand the basic sh set of b)-.15 F .651(uiltin commands.)-.2 F +F1(Let)5.651 E F0(pro)3.151 E .651(vides a w)-.15 F .651 +(ay to perform arithmetic)-.1 F 2.767(on shell v)72 453.6 R 5.268 +(ariables. Shell)-.25 F 2.768(programmers use)5.268 F F1(typeset)5.268 E F0 +2.768(\(bash includes)5.268 F F1(declar)5.268 E(e)-.18 E F0 2.768(as a synon) +5.268 F 2.768(ym\) to assign)-.15 F(attrib)72 465.6 Q .295(utes such as)-.2 F +F3 -.2(ex)2.795 G(port).2 E F0(and)4.461 E F3 -.37(re)2.795 G(adonly).37 E F0 +.295(to v)4.461 F(ariables.)-.25 E F1(Getopts)5.295 E F0 .294 +(is used by shell scripts to parse script options)2.795 F .962(and ar)72 477.6 +R 3.462(guments. The)-.18 F F1(set)3.462 E F0 .962(command has a ne)3.462 F +3.462(wo)-.25 G(ption)266.446 477.6 Q F1<ad6f>3.463 E F0 .963(which tak)3.463 F +.963(es option names as ar)-.1 F 3.463(guments. Option)-.18 F 1.28 +(names are synon)72 489.6 R 1.28(yms for the other set options \(e.g.,)-.15 F +F1<ad66>3.78 E F0(and)3.78 E F1 1.28(\255o noglob)3.78 F F0 3.78(\)o)C 3.78(rp) +375.97 489.6 S(ro)388.08 489.6 Q 1.28(vide ne)-.15 F 3.78(wf)-.25 G 1.28 +(unctionality \()440.78 489.6 R F1(-o)A(notify)72 501.6 Q F0 3.348(,f)C .849 +(or e)106.178 501.6 R 3.349(xample\). The)-.15 F F1 -.18(re)3.349 G(ad).18 E F0 +-.2(bu)3.349 G .849(iltin tak).2 F .849(es a ne)-.1 F(w)-.25 E F1<ad72>3.349 E +F0 .849(option to specify that a line ending in a backslash)3.349 F +(should not be continued.)72 513.6 Q F1 2.5(4.2.3. T)72 537.6 R(ilde Expansion) +-.18 E F0 -.35(Ti)97 553.2 S .252(lde e).35 F .251 +(xpansion is a feature adopted from the C shell.)-.15 F 2.751(At)5.251 G .251 +(ilde character at the be)331.172 553.2 R .251(ginning of a w)-.15 F .251 +(ord is)-.1 F -.15(ex)72 565.2 S(panded to either).15 E F1($HOME)2.5 E F0 +(or the home directory of another user)2.5 E 2.5(,d)-.4 G +(epending on what follo)345.84 565.2 Q(ws the tilde.)-.25 E F1 2.5 +(4.2.4. Interacti)72 589.2 R .2 -.1(ve I)-.1 H(mpr).1 E -.1(ove)-.18 G(ments).1 +E F0 .789(The most noticable impro)97 604.8 R -.15(ve)-.15 G .789(ments o).15 F +-.15(ve)-.15 G 3.289(rs).15 G 3.289(ha)263.385 604.8 S .789 +(re geared for interacti)276.114 604.8 R 1.089 -.15(ve u)-.25 H 3.29(se. Ksh) +.15 F .79(and bash pro)3.29 F .79(vide job)-.15 F .882(control in a v)72 616.8 +R .882(ery similar f)-.15 F .882 +(ashion, with the same options to enable and disable it \()-.1 F F1 .881 +(set -o monitor)B F0 3.381(\)a)C .881(nd the)478.399 616.8 R(same b)72 628.8 Q +(uiltin commands to manipulate jobs \()-.2 E F1(jobs/fg/bg/kill/wait)A F0(\).)A +.866(Command line editing, with emacs and vi-style k)97 644.4 R 1.166 -.15 +(ey b)-.1 H .866(indings, is a).15 F -.25(va)-.2 G .866(ilable in both shells.) +.25 F .866(The Bash)5.866 F F3 -.37(re)72 656.4 S(adline).37 E F0 1.578 +(library is considerably more sophisticated than the ksh editing library:)5.744 +F 1.577(it allo)6.577 F 1.577(ws arbitrary k)-.25 F -.15(ey)-.1 G 1.867 +(bindings, macros, a per)72 668.4 R 1.868(-user customization \214le \()-.2 F +F3(~/.inputr)A(c)-.37 E F0 1.868(\), a number of v)B 1.868 +(ariables to further customize)-.25 F(beha)72 680.4 Q(vior)-.2 E 3.538(,a)-.4 G +1.038(nd a much lar)116.868 680.4 R 1.038 +(ger set of bindable editing commands.)-.18 F 1.037 +(The ksh editing library pro)6.037 F 1.037(vides a small)-.15 F<8c78>72 692.4 Q +(ed command set and only clumsy macros.)-.15 E .706(Both shells of)97 708 R +.706(fer access to the command history)-.25 F 5.706(.T)-.65 G .706 +(he in-line editing options ha)307.278 708 R 1.006 -.15(ve d)-.2 H(ef).15 E +.706(ault k)-.1 F 1.006 -.15(ey b)-.1 H(ind-).15 E .624 +(ings to access the history list.)72 720 R(The)5.624 E F1(fc)3.124 E F0 .624 +(command is pro)3.124 F .624(vided to re-e)-.15 F -.15(xe)-.15 G .623(cute pre) +.15 F .623(vious commands and display)-.25 F EP +%%Page: 6 6 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 2.5(-6-)279.67 48 S(the contents of the history list.) +72 84 Q/F1 10/Times-Bold@0 SF 2.5(4.2.5. Miscellaneous)72 108 R +(Changes and Impr)2.5 E -.1(ov)-.18 G(ments).1 E F0 .707(Other impro)97 123.6 R +-.15(ve)-.15 G .707(ments include aliases, the).15 F F1(select)3.207 E F0 .708 +(shell language construct, which supports the genera-)3.207 F 1.298 +(tion and presentation of simple menus, and e)72 135.6 R 1.298 +(xtensions to the)-.15 F F1(export)3.798 E F0(and)3.798 E F1 -.18(re)3.798 G +(adonly).18 E F0 -.2(bu)3.798 G 1.298(iltins which allo).2 F(w)-.25 E -.25(va) +72 147.6 S .017(riables to be assigned v).25 F .017 +(alues at the same time the attrib)-.25 F .017(utes are set.)-.2 F -.8(Wo)5.018 +G .018(rd splitting has changed:).8 F .018(if tw)5.018 F 2.518(oo)-.1 G(r) +500.67 147.6 Q .158(more adjacent w)72 159.6 R .157 +(ord splitting characters occur)-.1 F 2.657(,b)-.4 G .157 +(ash and ksh will generate null \214elds; sh mak)264.893 159.6 R .157 +(es runs of mul-)-.1 F .339 +(tiple \214eld separator charactors the same as a single separator)72 171.6 R +5.339(.B)-.55 G .34(ash and ksh split only the results of e)330.89 171.6 R +(xpan-)-.15 E(sion, rather than e)72 183.6 Q -.15(ve)-.25 G(ry w).15 E +(ord as sh does, closing a long-standing shell security hole.)-.1 E 1.234 +(Shell functions in bash and ksh may ha)97 199.2 R 1.534 -.15(ve l)-.2 H 1.234 +(ocal v).15 F 3.734(ariables. V)-.25 F 1.234(ariables declared with)-1.11 F F1 +(typeset)3.734 E F0 1.234(\(or the)3.734 F .001(bash synon)72 211.2 R(ym,)-.15 +E F1(local)2.501 E F0 .001(\), ha)B .301 -.15(ve a s)-.2 H .001 +(cope restricted to the function and its descendents, and may shado).15 F 2.502 +(wv)-.25 G(ariables)472.9 211.2 Q(de\214ned by the in)72 223.2 Q -.2(vo)-.4 G +(king shell.).2 E(Local v)5 E(ariables are remo)-.25 E -.15(ve)-.15 G 2.5(dw) +.15 G(hen a function completes.)317.75 223.2 Q F1 2.5(4.3. F)72 247.2 R(eatur) +-.25 E(es Unique to bash)-.18 E F0(Naturally)97 262.8 Q 2.895(,b)-.65 G .395 +(ash includes features not in sh or ksh.)144.515 262.8 R .395 +(This section discusses some of the features which)5.395 F(mak)72 274.8 Q 2.986 +(eb)-.1 G .486(ash unique.)101.546 274.8 R .486(Most of them pro)5.486 F .486 +(vide impro)-.15 F -.15(ve)-.15 G 2.986(di).15 G(nteracti)288.098 274.8 Q .787 +-.15(ve u)-.25 H .487(se, b).15 F .487(ut a fe)-.2 F 2.987(wp)-.25 G .487 +(rogramming impro)394.653 274.8 R -.15(ve)-.15 G(ments).15 E +(are present as well.)72 286.8 Q +(Full descriptions of these features can be found in the bash documentation.)5 +E F1 2.5(4.3.1. Startup)72 310.8 R(Files)2.5 E F0 .281(Bash e)97 326.4 R -.15 +(xe)-.15 G .281(cutes startup \214les dif).15 F .281 +(ferently than other shells.)-.25 F .281(The bash beha)5.281 F .28 +(vior is a compromise between)-.2 F .116 +(the csh principle of startup \214les with \214x)72 338.4 R .116(ed names e) +-.15 F -.15(xe)-.15 G .116(cuted for each shell and the sh `).15 F +(`minimalist')-.74 E 2.616('b)-.74 G(eha)472.26 338.4 Q(vior)-.2 E(.)-.55 E +2.956(An interacti)72 350.4 R 3.256 -.15(ve i)-.25 H 2.956 +(nstance of bash started as a login shell reads and e).15 F -.15(xe)-.15 G +(cutes).15 E/F2 10/Times-Italic@0 SF(~/.bash_pr)5.455 E(o\214le)-.45 E F0 2.955 +(\(the \214le)7.121 F F2(.bash_pr)72 362.4 Q(o\214le)-.45 E F0 .835 +(in the user')5 F 3.335(sh)-.55 G .835(ome directory\), if it e)187.385 362.4 R +3.335(xists. An)-.15 F(interacti)3.335 E 1.135 -.15(ve n)-.25 H .835 +(on-login shell reads and e).15 F -.15(xe)-.15 G(cutes).15 E F2(~/.bashr)72 +374.4 Q(c)-.37 E F0 5.538(.A)1.666 G(non-interacti)127.422 374.4 Q .838 -.15 +(ve s)-.25 H .538(hell \(one be).15 F .538(gun to e)-.15 F -.15(xe)-.15 G .538 +(cute a shell script, for e).15 F .537(xample\) reads no \214x)-.15 F .537 +(ed startup)-.15 F .139(\214le, b)72 386.4 R .139(ut uses the v)-.2 F .139 +(alue of the v)-.25 F(ariable)-.25 E F1(ENV)2.639 E F0 2.639(,i)C 2.639(fs) +253.361 386.4 S .139(et, as the name of a startup \214le.)263.22 386.4 R .139 +(The ksh practice of reading)5.139 F F1($ENV)72 398.4 Q F0 .69(for e)3.19 F +-.15(ve)-.25 G .69(ry shell, with the accompan).15 F .689(ying dif)-.15 F .689 +(\214culty of de\214ning the proper v)-.25 F .689(ariables and functions for) +-.25 F(interacti)72 410.4 Q .946 -.15(ve a)-.25 H .646(nd non-interacti).15 F +.946 -.15(ve s)-.25 H .646(hells or ha).15 F .646 +(ving the \214le read only for interacti)-.2 F .946 -.15(ve s)-.25 H .646 +(hells, w).15 F .646(as considered too)-.1 F(comple)72 422.4 Q(x.)-.15 E F1 2.5 +(4.3.2. New)72 446.4 R(Builtin Commands)2.5 E F0 1.119(There are a fe)97 462 R +3.619(wb)-.25 G 1.118(uiltins which are ne)170.986 462 R 3.618(wo)-.25 G 3.618 +(rh)268.528 462 S -2.25 -.2(av e)280.476 462 T 1.118(been e)3.818 F 1.118 +(xtended in bash.)-.15 F(The)6.118 E F1(enable)3.618 E F0 -.2(bu)3.618 G 1.118 +(iltin allo).2 F(ws)-.25 E -.2(bu)72 474 S .736 +(iltin commands to be turned on and of).2 F 3.236(fa)-.25 G(rbitrarily)250.198 +474 Q 5.736(.T)-.65 G 3.237(ou)298.644 474 S .737(se the v)311.881 474 R .737 +(ersion of)-.15 F F2(ec)3.237 E(ho)-.15 E F0 .737(found in a user')4.903 F +3.237(ss)-.55 G(earch)482.35 474 Q .013(path rather than the bash b)72 486 R +(uiltin,)-.2 E/F3 10/Courier@0 SF .013(enable -n echo)2.513 F F0(suf)2.513 E +2.513(\214ces. The)-.25 F F1(help)2.513 E F0 -.2(bu)2.513 G .013(iltin pro).2 F +.013(vides quick synopses of)-.15 F 1.382(the shell f)72 498 R 1.382 +(acilities without requiring access to a manual page.)-.1 F F1(Builtin)6.382 E +F0 1.383(is similar to)3.882 F F1(command)3.883 E F0 1.383(in that it)3.883 F +.342(bypasses shell functions and directly e)72 510 R -.15(xe)-.15 G .342 +(cutes b).15 F .342(uiltin commands.)-.2 F .342 +(Access to a csh-style stack of directories)5.342 F .072(is pro)72 522 R .073 +(vided via the)-.15 F F1(pushd)2.573 E F0(,)A F1(popd)2.573 E F0 2.573(,a)C(nd) +211.197 522 Q F1(dirs)2.573 E F0 -.2(bu)2.573 G(iltins.).2 E F1(Pushd)5.073 E +F0(and)2.573 E F1(popd)2.573 E F0 .073(insert and remo)2.573 F .373 -.15(ve d) +-.15 H .073(irectories from the).15 F .094(stack, respecti)72 534 R -.15(ve) +-.25 G(ly).15 E 2.594(,a)-.65 G(nd)154.448 534 Q F1(dirs)2.594 E F0 .094 +(lists the stack contents.The)2.594 F F1(suspend)2.594 E F0 .094 +(command will stop the shell process when)2.594 F 1.329(job control is acti)72 +546 R -.15(ve)-.25 G 3.829(;m).15 G 1.329(ost other shells do not allo)169.136 +546 R 3.829(wt)-.25 G(hemselv)294.64 546 Q 1.33(es to be stopped lik)-.15 F +3.83(et)-.1 G(hat.)421.31 546 Q F1 -.74(Ty)6.33 G(pe,).74 E F0 1.33(the bash) +3.83 F(answer to)72 558 Q F1(which)2.5 E F0(and)2.5 E F1(whence,)2.5 E F0(sho) +2.5 E(ws what will happen when a w)-.25 E(ord is typed as a command:)-.1 E F3 6 +($t)97 576 S(ype export)115 576 Q(export is a shell builtin)97 588 Q 6($t)97 +600 S(ype -t export)115 600 Q(builtin)97 612 Q 6($t)97 624 S(ype bash)115 624 Q +(bash is /bin/bash)97 636 Q 6($t)97 648 S(ype cd)115 648 Q(cd is a function)97 +660 Q(cd \(\))97 672 Q({)97 684 Q(builtin cd "$@" && xtitle $HOST: $PWD)121 696 +Q(})97 708 Q EP +%%Page: 7 7 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 2.5(-7-)279.67 48 S -1.11(Va)72 84 S .682 +(rious modes tell what a command w)1.11 F .681(ord is \(reserv)-.1 F .681(ed w) +-.15 F .681(ord, alias, function, b)-.1 F .681(uiltin, or \214le\) or which v) +-.2 F(er)-.15 E(-)-.2 E 1.15(sion of a command will be e)72 96 R -.15(xe)-.15 G +1.15(cuted based on a user').15 F 3.65(ss)-.55 G 1.15(earch path.)305.7 96 R +1.15(Some of this functionality has been)6.15 F +(adopted by POSIX.2 and folded into the)72 108 Q/F1 10/Times-Bold@0 SF(command) +2.5 E F0(utility)2.5 E(.)-.65 E F1 2.5(4.3.3. Editing)72 132 R(and Completion) +2.5 E F0 .682(One area in which bash shines is command line editing.)97 147.6 R +.682(Bash uses the)5.682 F/F2 10/Times-Italic@0 SF -.37(re)3.182 G(adline).37 E +F0 .682(library to read and)4.848 F .102(edit lines when interacti)72 159.6 R +-.15(ve)-.25 G 5.102(.R).15 G .103(eadline is a po)191.438 159.6 R .103 +(werful and \215e)-.25 F .103(xible input f)-.15 F .103 +(acility that a user can con\214gure to his)-.1 F 2.506(tastes. It)72 171.6 R +(allo)2.506 E .006(ws lines to be edited using either emacs or vi commands, wh\ +ere those commands are appropri-)-.25 F 2.994(ate. The)72 183.6 R .494 +(full capability of emacs is not present \255 there is no w)2.994 F .495 +(ay to e)-.1 F -.15(xe)-.15 G .495(cute a named command with M-x,).15 F .222 +(for instance \255 b)72 195.6 R .222(ut the e)-.2 F .222 +(xisting commands are more than adequate.)-.15 F .221 +(The vi mode is compliant with the com-)5.222 F +(mand line editing standardized by POSIX.2.)72 207.6 Q 1.69 +(Readline is fully customizable.)97 223.2 R 1.691 +(In addition to the basic commands and k)6.69 F 1.991 -.15(ey b)-.1 H 1.691 +(indings, the library).15 F(allo)72 235.2 Q .83 +(ws users to de\214ne additional k)-.25 F 1.13 -.15(ey b)-.1 H .83 +(indings using a startup \214le.).15 F(The)5.83 E F2(inputr)3.329 E(c)-.37 E F0 +.829(\214le, which def)4.995 F .829(aults to the)-.1 F(\214le)72 247.2 Q F2 +(~/.inputr)4.287 E(c)-.37 E F0 4.287(,i)1.666 G 4.287(sr)137.43 247.2 S 1.788(\ +ead each time readline initializes, permitting users to maintain a consistent \ +interf)148.937 247.2 R(ace)-.1 E .547(across a set of programs.)72 259.2 R .546 +(Readline includes an e)5.546 F .546(xtensible interf)-.15 F .546 +(ace, so each program using the library can)-.1 F .23(add its o)72 271.2 R .23 +(wn bindable commands and program-speci\214c k)-.25 F .531 -.15(ey b)-.1 H +2.731(indings. Bash).15 F .231(uses this f)2.731 F .231 +(acility to add bindings)-.1 F(that perform history e)72 283.2 Q +(xpansion or shell w)-.15 E(ord e)-.1 E(xpansions on the current input line.) +-.15 E .707(Readline interprets a number of v)97 298.8 R .706 +(ariables which further tune its beha)-.25 F(vior)-.2 E 5.706(.V)-.55 G .706 +(ariables e)408.432 298.8 R .706(xist to control)-.15 F .157 +(whether or not eight-bit characters are directly read as input or con)72 310.8 +R -.15(ve)-.4 G .158(rted to meta-pre\214x).15 F .158(ed k)-.15 F .458 -.15 +(ey s)-.1 H .158(equences \(a).15 F(meta-pre\214x)72 322.8 Q 1.575(ed k)-.15 F +1.875 -.15(ey s)-.1 H 1.575 +(equence consists of the character with the eighth bit zeroed, preceded by the) +.15 F F2(meta-)4.074 E(pr)72 334.8 Q(e\214x)-.37 E F0(character)4.45 E 2.784 +(,u)-.4 G .284(sually escape, which selects an alternate k)145.374 334.8 R -.15 +(ey)-.1 G .285(map\), to decide whether to output characters).15 F .485 +(with the eighth bit set directly or as a meta-pre\214x)72 346.8 R .485(ed k) +-.15 F .784 -.15(ey s)-.1 H .484(equence, whether or not to wrap to a ne).15 F +2.984(ws)-.25 G(creen)482.35 346.8 Q .157 +(line when a line being edited is longer than the screen width, the k)72 358.8 +R -.15(ey)-.1 G .158(map to which subsequent k).15 F .458 -.15(ey b)-.1 H +(indings).15 E .531(should apply)72 370.8 R 3.031(,o)-.65 G 3.031(re)133.802 +370.8 S -.15(ve)144.353 370.8 S 3.031(nw).15 G .531 +(hat happens when readline w)168.894 370.8 R .531(ants to ring the terminal') +-.1 F 3.03(sb)-.55 G 3.03(ell. All)399.37 370.8 R .53(of these v)3.03 F +(ariables)-.25 E(can be set in the inputrc \214le.)72 382.8 Q .284 +(The startup \214le understands a set of C preprocessor)97 398.4 R(-lik)-.2 E +2.785(ec)-.1 G .285(onditional constructs which allo)329.49 398.4 R 2.785(wv) +-.25 G(ariables)472.9 398.4 Q .12(or k)72 410.4 R .42 -.15(ey b)-.1 H .119(ind\ +ings to be assigned based on the application using readline, the terminal curr\ +ently being used, or).15 F .316(the editing mode.)72 422.4 R .317 +(Users can add program-speci\214c bindings to mak)5.317 F 2.817(et)-.1 G .317 +(heir li)352.808 422.4 R -.15(ve)-.25 G 2.817(se).15 G 2.817(asier: here) +396.922 422.4 R .317(are bindings to)2.817 F(edit the v)72 434.4 Q(alue of)-.25 +E F1 -.74(PA)2.5 G(TH)-.21 E F0(and double-quote the current or pre)2.5 E +(vious w)-.25 E(ord:)-.1 E/F3 10/Courier@0 SF 6(#M)97 452.4 S +(acros that are convenient for shell interaction)115 452.4 Q($if Bash)97 464.4 +Q 6(#e)97 476.4 S(dit the path)115 476.4 Q +("\\C-xp": "PATH=${PATH}\\e\\C-e\\C-a\\ef\\C-f")97 488.4 Q 6(#p)97 500.4 S +(repare to type a quoted word -- insert open and close double quotes)115 500.4 +Q 6(#a)97 512.4 S(nd move to just after the open quote)115 512.4 Q +("\\C-x\\"": "\\"\\"\\C-b")97 524.4 Q 6(#Q)97 536.4 S +(uote the current or previous word)115 536.4 Q("\\C-xq": "\\eb\\"\\ef\\"")97 +548.4 Q($endif)97 560.4 Q F0 .322(There is a readline command to re-read the \ +\214le, so users can edit the \214le, change some bindings, and be)72 582 R +(gin)-.15 E(to use them almost immediately)72 594 Q(.)-.65 E .851 +(Bash implements the)97 609.6 R F1(bind)3.351 E F0 -.2(bu)3.351 G .851 +(iltin for more dyamic control of readline than the startup \214le permits.).2 +F F1(Bind)72 621.6 Q F0 .167(is used in se)2.667 F -.15(ve)-.25 G .167(ral w) +.15 F 2.667(ays. In)-.1 F F2(list)2.667 E F0 .167 +(mode, it can display the current k)4.333 F .466 -.15(ey b)-.1 H .166 +(indings, list all the readline edit-).15 F .149(ing directi)72 633.6 R -.15 +(ve)-.25 G 2.649(sa).15 G -.25(va)132.798 633.6 S .149 +(ilable for binding, list which k).25 F -.15(ey)-.1 G 2.649(si).15 G -1.9 -.4 +(nv o)282.352 633.6 T .349 -.1(ke a g).4 H -2.15 -.25(iv e).1 H 2.65(nd).25 G +(irecti)345.3 633.6 Q -.15(ve)-.25 G 2.65(,o).15 G 2.65(ro)385.04 633.6 S .15 +(utput the current set of k)396.02 633.6 R -.15(ey)-.1 G .526(bindings in a fo\ +rmat that can be incorporated directly into an inputrc \214le.)72 645.6 R(In) +5.526 E F2(batc)3.026 E(h)-.15 E F0 .526(mode, it reads a series)4.692 F .71 +(of k)72 657.6 R 1.01 -.15(ey b)-.1 H .71 +(indings directly from a \214le and passes them to readline.).15 F .71 +(In its most common usage,)5.71 F F1(bind)3.21 E F0(tak)3.21 E .71(es a)-.1 F +.534(single string and passes it directly to readline, which interprets the li\ +ne as if it had just been read from the)72 669.6 R(inputrc \214le.)72 681.6 Q +(Both k)5 E .3 -.15(ey b)-.1 H(indings and v).15 E +(ariable assignments can appear in the string gi)-.25 E -.15(ve)-.25 G 2.5(nt) +.15 G(o)424.4 681.6 Q F1(bind)2.5 E F0(.)A .401(The readline library also pro) +97 697.2 R .402(vides an interf)-.15 F .402(ace for)-.1 F F2(wor)2.902 E 2.902 +(dc)-.37 G(ompletion)328.546 697.2 Q F0 5.402(.W)C .402(hen the)385.888 697.2 R +F2(completion)2.902 E F0(character)4.568 E 1.261(\(usually T)72 709.2 R 1.261 +(AB\) is typed, readline looks at the w)-.93 F 1.26 +(ord currently being entered and computes the set of \214le-)-.1 F .523 +(names of which the current w)72 721.2 R .523(ord is a v)-.1 F .523 +(alid pre\214x.)-.25 F .524 +(If there is only one possible completion, the rest of the)5.523 F EP +%%Page: 8 8 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 2.5(-8-)279.67 48 S .358 +(characters are inserted directly)72 84 R 2.858(,o)-.65 G .358(therwise the co\ +mmon pre\214x of the set of \214lenames is added to the current)205.232 84 R +-.1(wo)72 96 S 3.199(rd. A).1 F .699(second T)3.199 F .699(AB character entere\ +d immediately after a non-unique completion causes readline to list)-.93 F +1.814(the possible completions; there is an option to ha)72 108 R 2.113 -.15 +(ve t)-.2 H 1.813(he list displayed immediately).15 F 6.813(.R)-.65 G 1.813 +(eadline pro)436.517 108 R(vides)-.15 E .482 +(hooks so that applications can pro)72 120 R .482 +(vide speci\214c types of completion before the def)-.15 F .483 +(ault \214lename completion)-.1 F .132(is attempted.)72 132 R .132 +(This is quite \215e)5.132 F .132(xible, though it is not completely user)-.15 +F 2.632(-programmable. Bash,)-.2 F .132(for e)2.632 F .132(xample, can)-.15 F +.37(complete \214lenames, command names \(including aliases, b)72 144 R .37 +(uiltins, shell reserv)-.2 F .37(ed w)-.15 F .37(ords, shell functions, and)-.1 +F -.15(exe)72 156 S .424(cutables found in the \214le system\), shell v).15 F +.424(ariables, usernames, and hostnames.)-.25 F .423 +(It uses a set of heuristics)5.424 F(that, while not perfect, is generally qui\ +te good at determining what type of completion to attempt.)72 168 Q/F1 10 +/Times-Bold@0 SF 2.5(4.3.4. History)72 192 R F0 .255 +(Access to the list of commands pre)97 207.6 R .255(viously entered \(the)-.25 +F/F2 10/Times-Italic@0 SF .255(command history)2.755 F F0 2.756(\)i)C 2.756(sp) +399.236 207.6 S(ro)410.882 207.6 Q .256(vided jointly by bash)-.15 F .095 +(and the readline library)72 219.6 R 5.094(.B)-.65 G .094(ash pro)178.928 219.6 +R .094(vides v)-.15 F .094(ariables \()-.25 F F1(HISTFILE)A F0(,)A F1(HISTSIZE) +2.594 E F0 2.594(,a)C(nd)382.068 219.6 Q F1(HISTCONTR)2.594 E(OL)-.3 E F0 2.594 +(\)a)C .094(nd the)479.186 219.6 R F1(history)72 231.6 Q F0(and)2.825 E F1(fc) +2.825 E F0 -.2(bu)2.825 G .325(iltins to manipulate the history list.).2 F .325 +(The v)5.325 F .325(alue of)-.25 F F1(HISTFILE)2.825 E F0 .326 +(specifes the \214le where bash)2.826 F .128(writes the command history on e)72 +243.6 R .128(xit and reads it on startup.)-.15 F F1(HISTSIZE)5.128 E F0 .128 +(is used to limit the number of com-)2.628 F .346(mands sa)72 255.6 R -.15(ve) +-.2 G 2.846(di).15 G 2.846(nt)129.002 255.6 S .346(he history)139.628 255.6 R +(.)-.65 E F1(HISTCONTR)5.346 E(OL)-.3 E F0(pro)2.846 E .346 +(vides a crude form of control o)-.15 F -.15(ve)-.15 G 2.846(rw).15 G .346 +(hich commands are)425.548 255.6 R(sa)72 267.6 Q -.15(ve)-.2 G 2.905(do).15 G +2.905(nt)102.325 267.6 S .405(he history list: a v)113.01 267.6 R .405(alue of) +-.25 F F2(ignor)2.905 E(espace)-.37 E F0 .405(means to not sa)4.571 F .705 -.15 +(ve c)-.2 H .405(ommands which be).15 F .405(gin with a space; a)-.15 F -.25 +(va)72 279.6 S .339(lue of).25 F F2(ignor)2.839 E(edups)-.37 E F0 .339 +(means to not sa)4.505 F .64 -.15(ve c)-.2 H .34 +(ommands identical to the last command sa).15 F -.15(ve)-.2 G(d.).15 E F1 +(HISTCONTR)5.34 E(OL)-.3 E F0 -.1(wa)72 291.6 S 3.15(sn).1 G(amed)95.6 291.6 Q +F1(history_contr)3.15 E(ol)-.18 E F0 .65(in earlier v)3.15 F .649 +(ersions of bash; the old name is still accepted for backw)-.15 F .649 +(ards com-)-.1 F(patibility)72 303.6 Q 5.723(.T)-.65 G(he)121.803 303.6 Q F1 +(history)3.223 E F0 .724(command can read or write \214les containing the hist\ +ory list and display the current)3.223 F .895(list contents.)72 315.6 R(The) +5.895 E F1(fc)3.395 E F0 -.2(bu)3.395 G .895 +(iltin, adopted from POSIX.2 and the K).2 F .894(orn Shell, allo)-.35 F .894 +(ws display and re-e)-.25 F -.15(xe)-.15 G(cution,).15 E .461 +(with optional editing, of commands from the history list.)72 327.6 R .462 +(The readline library of)5.462 F .462(fers a set of commands to)-.25 F .657(se\ +arch the history list for a portion of the current input line or a string type\ +d by the user)72 339.6 R 5.657(.F)-.55 G(inally)445.836 339.6 Q 3.157(,t)-.65 G +(he)476.403 339.6 Q F2(his-)3.157 E(tory)72 351.6 Q F0(library)4.196 E 2.53(,g) +-.65 G .03(enerally incorporated directly into the readline library)128.346 +351.6 R 2.53(,i)-.65 G .03(mplements a f)350.636 351.6 R .031 +(acility for history recall,)-.1 F -.15(ex)72 363.6 S .594(pansion, and re-e) +.15 F -.15(xe)-.15 G .594(cution of pre).15 F .594(vious commands v)-.25 F .594 +(ery similar to csh \(`)-.15 F .593(`bang history')-.74 F .593 +(', so called because)-.74 F(the e)72 375.6 Q +(xclamation point introduces a history substitution\):)-.15 E/F3 10/Courier@0 +SF 6($e)97 393.6 S(cho a b c d e)115 393.6 Q 6(abcde)97 405.6 S 6($!)97 417.6 S +6(!fghi)115 417.6 S(echo a b c d e f g h i)97 429.6 Q 6(abcdefghi)97 441.6 S 6 +($!)97 453.6 S(-2)115 453.6 Q(echo a b c d e)97 465.6 Q 6(abcde)97 477.6 S 6 +($e)97 489.6 S(cho !-2:1-4)115 489.6 Q(echo a b c d)97 501.6 Q 6(abcd)97 513.6 +S F0 1.456(The command history is only sa)72 535.2 R -.15(ve)-.2 G 3.957(dw).15 +G 1.457(hen the shell is interacti)232.599 535.2 R -.15(ve)-.25 G 3.957(,s).15 +G 3.957(oi)352.804 535.2 S 3.957(ti)364.541 535.2 S 3.957(sn)374.058 535.2 S +1.457(ot a)386.905 535.2 R -.25(va)-.2 G 1.457(ilable for use by shell).25 F +(scripts.)72 547.2 Q F1 2.5(4.3.5. New)72 571.2 R(Shell V)2.5 E(ariables)-.92 E +F0 .701(There are a number of con)97 586.8 R -.15(ve)-.4 G .701(nience v).15 F +.701(ariables that bash interprets to mak)-.25 F 3.2(el)-.1 G .7(ife easier) +402.76 586.8 R 5.7(.T)-.55 G .7(hese include)453.59 586.8 R F1(FIGNORE)72 598.8 +Q F0 3.973(,w)C 1.473(hich is a set of \214lename suf)132.363 598.8 R<8c78>-.25 +E 1.474(es identifying \214les to e)-.15 F 1.474 +(xclude when completing \214lenames;)-.15 F F1(HOSTTYPE)72 610.8 Q F0 3.03(,w)C +.53(hich is automatically set to a string describing the type of hardw)139.21 +610.8 R .53(are on which bash is cur)-.1 F(-)-.2 E .76(rently e)72 622.8 R -.15 +(xe)-.15 G(cuting;).15 E F1(OSTYPE)3.26 E F0 3.26(,t)C 3.26(ow)191.76 622.8 S +.76(hich bash assigns a v)207.24 622.8 R .761(alue that identi\214es the v)-.25 +F .761(ersion of)-.15 F/F4 9/Times-Roman@0 SF(UNIX)3.261 E F0(it')3.261 E 3.261 +(sr)-.55 G(unning)476.22 622.8 Q 1.354 +(on \(great for putting architecture-speci\214c binary directories into the)72 +634.8 R F1 -.74(PA)3.854 G(TH)-.21 E F0 1.354(\); and)B F1(IGNOREEOF)3.854 E F0 +3.854(,w)C(hose)485.67 634.8 Q -.25(va)72 646.8 S .062 +(lue indicates the number of consecuti).25 F .362 -.15(ve E)-.25 H .062 +(OF characters that an interacti).15 F .362 -.15(ve s)-.25 H .062 +(hell will read before e).15 F .062(xiting \255)-.15 F .114(an easy w)72 658.8 +R .113(ay to k)-.1 F .113(eep yourself from being logged out accidentally)-.1 F +5.113(.T)-.65 G(he)344.285 658.8 Q F1(auto_r)2.613 E(esume)-.18 E F0 -.25(va) +2.613 G .113(riable alters the w).25 F(ay)-.1 E .409 +(the shell treats simple command names: if job control is acti)72 670.8 R -.15 +(ve)-.25 G 2.909(,a).15 G .409(nd this v)335.516 670.8 R .409 +(ariable is set, single-w)-.25 F .409(ord simple)-.1 F .17(commands without re\ +directions cause the shell to \214rst look for a suspended job with that name \ +before start-)72 682.8 R(ing a ne)72 694.8 Q 2.5(wp)-.25 G(rocess.)118.13 694.8 +Q EP +%%Page: 9 9 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 2.5(-9-)279.67 48 S/F1 10/Times-Bold@0 SF 2.5 +(4.3.6. Brace)72 84 R(Expansion)2.5 E F0 .653(Since sh of)97 99.6 R .653 +(fers no con)-.25 F -.15(ve)-.4 G .653(nient w).15 F .653 +(ay to generate arbitrary strings that share a common pre\214x or suf)-.1 F +<8c78>-.25 E 1.893(\(pathname e)72 111.6 R 1.893 +(xpansion requires that the \214lenames e)-.15 F 1.892(xist\), bash implements) +-.15 F/F2 10/Times-Italic@0 SF(br)4.392 E 1.892(ace e)-.15 F(xpansion)-.2 E F0 +4.392(,ac)C(apability)469 111.6 Q(pick)72 123.6 Q .496(ed up from csh.)-.1 F +.496(Brace e)5.496 F .496(xpansion is similar to pathname e)-.15 F .496 +(xpansion, b)-.15 F .497(ut the strings generated need not)-.2 F 1.107 +(correspond to e)72 135.6 R 1.107(xisting \214les.)-.15 F 3.607(Ab)6.107 G +1.107(race e)207.655 135.6 R 1.107(xpression consists of an optional)-.15 F F2 +(pr)3.606 E(eamble)-.37 E F0 3.606(,f)1.666 G(ollo)419.286 135.6 Q 1.106 +(wed by a pair of)-.25 F 2.809 +(braces enclosing a series of comma-separated strings, and an optional)72 147.6 +R F2(postamble)5.31 E F0 7.81(.T)1.666 G 2.81(he preamble is)440.06 147.6 R(pr\ +epended to each string within the braces, and the postamble is then appended t\ +o each resulting string:)72 159.6 Q/F3 10/Courier@0 SF 6($e)97 177.6 S +(cho a{d,c,b}e)115 177.6 Q(ade ace abe)97 189.6 Q F1 2.5(4.3.7. Pr)72 219.6 R +(ompt Customization)-.18 E F0 .077(One of the more popular interacti)97 235.2 R +.376 -.15(ve f)-.25 H .076(eatures that bash pro).15 F .076 +(vides is the ability to customize the prompt.)-.15 F(Both)72 247.2 Q F1(PS1) +3.305 E F0(and)3.305 E F1(PS2,)3.305 E F0 .805 +(the primary and secondary prompts, are e)3.305 F .805 +(xpanded before being displayed.)-.15 F -.15(Pa)5.805 G(rameter).15 E .324 +(and v)72 259.2 R .324(ariable e)-.25 F .324 +(xpansion is performed when the prompt string is e)-.15 F .323 +(xpanded, so the v)-.15 F .323(alue of an)-.25 F 2.823(ys)-.15 G .323(hell v) +454.217 259.2 R(ariable)-.25 E .728(can be put into the prompt \(e.g.,)72 271.2 +R F1($SHL)3.228 E(VL)-.92 E F0 3.228(,w)C .728(hich indicates ho)258.564 271.2 +R 3.228(wd)-.25 G .729(eeply the current shell is nested\).)342.988 271.2 R +(Bash)5.729 E 1.895 +(specially interprets characters in the prompt string preceded by a backslash.) +72 283.2 R 1.895(Some of these backslash)6.895 F .874 +(escapes are replaced with the current time, the date, the current w)72 295.2 R +.874(orking directory)-.1 F 3.374(,t)-.65 G .874(he username, and the)416.958 +295.2 R .781(command number or history number of the command being entered.)72 +307.2 R .78(There is e)5.781 F -.15(ve)-.25 G 3.28(nab).15 G .78 +(ackslash escape to)429.13 307.2 R .007 +(cause the shell to change its prompt when running as root after an)72 319.2 R +F2(su)2.507 E F0 5.007(.B)C .008(efore printing each primary prompt,)360.388 +319.2 R .27(bash e)72 331.2 R .27(xpands the v)-.15 F(ariable)-.25 E F1(PR)2.77 +E(OMPT_COMMAND)-.3 E F0 .269(and, if it has a v)2.77 F .269(alue, e)-.25 F -.15 +(xe)-.15 G .269(cutes the e).15 F .269(xpanded v)-.15 F .269(alue as a)-.25 F +.04(command, allo)72 343.2 R .041(wing additional prompt customization.)-.25 F +-.15(Fo)5.041 G 2.541(re).15 G .041 +(xample, this assignment causes the current user)311.964 343.2 R(,)-.4 E .99 +(the current host, the time, the last component of the current w)72 355.2 R +.989(orking directory)-.1 F 3.489(,t)-.65 G .989(he le)402.954 355.2 R -.15(ve) +-.25 G 3.489(lo).15 G 3.489(fs)443.412 355.2 S .989(hell nesting,)454.121 355.2 +R(and the history number of the current command to be embedded into the primar\ +y prompt:)72 367.2 Q F3 6($P)97 385.2 S +(S1='\\u@\\h [\\t] \\W\($SHLVL:\\!\)\\$ ')115 385.2 Q +(chet@odin [21:03:44] documentation\(2:636\)$ cd ..)97 397.2 Q +(chet@odin [21:03:54] src\(2:637\)$)97 409.2 Q F0 .619 +(The string being assigned is surrounded by single quotes so that if it is e)72 +430.8 R(xported,)-.15 E F1(SHL)3.119 E(VL)-.92 E F0 .619(will be updated)3.119 +F(by a child shell:)72 442.8 Q F3 +(chet@odin [21:13:35] src\(2:638\)$ export PS1)97 460.8 Q +(chet@odin [21:17:40] src\(2:639\)$ bash)97 472.8 Q +(chet@odin [21:17:46] src\(3:696\)$)97 484.8 Q F0(The)72 506.4 Q F1(\\$)2.5 E +F0(escape is displayed as `)2.5 E(`)-.74 E F1($)A F0 1.48 -.74('' w)D +(hen running as a normal user).74 E 2.5(,b)-.4 G(ut as `)342.08 506.4 Q(`)-.74 +E F1(#)A F0 1.48 -.74('' w)D(hen running as root.).74 E F1 2.5(4.3.8. POSIX)72 +530.4 R(Mode)2.5 E F0 .46(Although bash is intended to be POSIX.2 compliant, t\ +here are areas in which the def)97 546 R .46(ault beha)-.1 F .46(vior is)-.2 F +1.168(not compatible with the standard.)72 558 R -.15(Fo)6.169 G 3.669(ru).15 G +1.169(sers who wish to operate in a strict POSIX.2 en)238.85 558 R 1.169 +(vironment, bash)-.4 F .61(implements a)72 570 R F2 .61(POSIX mode)3.11 F F0 +5.61(.W)C .61(hen this mode is acti)199.42 570 R -.15(ve)-.25 G 3.109(,b).15 G +.609(ash modi\214es its def)303.727 570 R .609(ault operation where it dif)-.1 +F(fers)-.25 E .066(from POSIX.2 to match the standard.)72 582 R .067 +(POSIX mode is entered when bash is started with the)5.066 F F1 .067(-o posix) +2.567 F F0(option)2.567 E .382(or when)72 594 R F1 .382(set -o posix)2.882 F F0 +.381(is e)2.881 F -.15(xe)-.15 G 2.881(cuted. F).15 F .381 +(or compatibility with other GNU softw)-.15 F .381 +(are that attempts to be POSIX.2)-.1 F 5.752 +(compliant, bash also enters POSIX mode if either of the v)72 606 R(ariables) +-.25 E F1(POSIX_PED)8.253 E(ANTIC)-.35 E F0(or)8.253 E F1(POSIXL)72 618 Q +(Y_CORRECT)-.92 E F0 1.179(is set when bash is started or assigned a v)3.679 F +1.178(alue during e)-.25 F -.15(xe)-.15 G 3.678(cution. When).15 F 1.178 +(bash is)3.678 F .218(started in POSIX mode, for e)72 630 R .218(xample, the) +-.15 F F1(kill)2.718 E F0 -.2(bu)2.718 G(iltin').2 E(s)-.55 E F1<ad6c>2.718 E +F0 .218(option beha)2.718 F -.15(ve)-.2 G 2.718(sd).15 G(if)370.166 630 Q .219 +(ferently: it lists the names of all)-.25 F 1.084(signals on a single line sep\ +arated by spaces, rather than listing the signal names and their corresponding) +72 642 R(numbers.)72 654 Q .865(Some of the def)97 669.6 R .865(ault bash beha) +-.1 F .865(vior dif)-.2 F .865 +(fers from other shells as a result of the POSIX standard.)-.25 F -.15(Fo)5.866 +G(r).15 E 1.16(instance, bash includes the)72 681.6 R F1(!)3.66 E F0(reserv) +6.16 E 1.16(ed w)-.15 F 1.16(ord to ne)-.1 F -.05(ga)-.15 G 1.16 +(te the return status of a pipeline because it has been).05 F +(de\214ned by POSIX.2.)72 693.6 Q +(Neither sh nor ksh has implemented that feature.)5 E EP +%%Page: 10 10 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 2.5(-1)277.17 48 S 2.5(0-)288 48 S/F1 10/Times-Bold@0 +SF 2.5(4.4. F)72 84 R(eatur)-.25 E(es Unique to ksh)-.18 E F0 .177 +(Ksh includes a number of features not in the currently-released v)97 99.6 R +.178(ersion of bash, v)-.15 F .178(ersion 1.14.)-.15 F(Unless)5.178 E .822 +(noted, none of these features is in the POSIX.2 standard.)72 111.6 R .821 +(Where appropriate the equi)5.821 F -.25(va)-.25 G .821(lent bash features).25 +F(are noted.)72 123.6 Q F1 2.5(4.4.1. The)72 147.6 R(ksh Language)2.5 E F0 +2.955(An)97 163.2 S .955 -.25(ew c)112.175 163.2 T .455(ompound command folds) +.25 F F1(test)2.955 E F0 .456(into the ksh language, delimited by the reserv) +2.955 F .456(ed w)-.15 F(ords)-.1 E F1([[)2.956 E F0(and)2.956 E F1(]])72 175.2 +Q F0 5.726(.T)C .726(he syntax is identical to)92.996 175.2 R F1(test)3.225 E +F0 .725(with a fe)3.225 F 3.225(wc)-.25 G .725 +(hanges: for instance, instead of)262.855 175.2 R F1<ad61>3.225 E F0(and)3.225 +E F1<ad6f>3.225 E F0(,)A F1(&&)3.225 E F0(and)3.225 E/F2 10/Symbol SF<efef> +3.225 E F0(are)3.225 E 3.32(used. The)72 187.2 R -.1(wo)3.32 G .82(rds between) +.1 F F1([[)3.32 E F0(and)3.32 E F1(]])3.32 E F0 .82(are not processed for w) +3.32 F .82(ord splitting or \214lename generation.)-.1 F .82(The ne)5.82 F(w) +-.25 E .926 +(command does pattern matching as well as string comparison, a la the)72 199.2 +R F1(case)3.425 E F0 3.425(command. This)3.425 F(ne)3.425 E 3.425(wc)-.25 G +(ontrol)480.11 199.2 Q .165(structure does ha)72 211.2 R .465 -.15(ve t)-.2 H +.165(he adv).15 F .166(antage of reducing common ar)-.25 F .166 +(gument problems encountered using test \(e.g.)-.18 F F1(test)2.666 E +("$string")72 223.2 Q F0 2.928(,w)C(here)125.748 223.2 Q F1($string)2.928 E F0 +-.15(ex)2.928 G .428(pands to).15 F F1<ad66>2.928 E F0 .428(\), b)B .428 +(ut at the cost of bloating the language.)-.2 F .427(The POSIX.2 test algo-) +5.427 F 2.752(rithm that bash uses, along with some programmer care, alle)72 +235.2 R 2.752(viates those problems in a backw)-.25 F(ards-)-.1 E .854 +(compatible w)72 247.2 R .853(ay with no additions to the language.)-.1 F .853 +(The one capability of)5.853 F F1 .853([[ ]])3.353 F F0 .853(not a)3.353 F -.25 +(va)-.2 G .853(ilable in bash is its).25 F(ability to test whether an indi)72 +259.2 Q(vidual)-.25 E F1(set \255o)2.5 E F0(option is turned on or of)2.5 E(f.) +-.25 E .339(Other parts of the ksh language are not common to bash.)97 274.8 R +(The)5.34 E F1(\(\(...\)\))2.84 E F0(operator)5.34 E 2.84(,e)-.4 G(qui)419.33 +274.8 Q -.25(va)-.25 G .34(lent to).25 F F1 .34(let "...")2.84 F F0(,)A .197 +(is unique to ksh, as are the concept of co-processes and the)72 286.8 R F1 +(time)2.697 E F0 -.1(ke)2.696 G(yw)-.05 E .196 +(ord to time commands and pipelines.)-.1 F F1 2.5(4.4.2. Functions)72 310.8 R +(and Aliases)2.5 E F0 1.022(The K)97 326.4 R 1.022(orn shell has)-.35 F/F3 10 +/Times-Italic@0 SF(autoloaded)3.522 E F0 3.522(functions. A)3.522 F 1.022 +(function mark)3.522 F 1.022(ed as)-.1 F F3(autoload)3.522 E F0 1.022 +(is not de\214ned until it is)5.188 F 1.042(\214rst e)72 338.4 R -.15(xe)-.15 G +3.542(cuted. When).15 F 1.042(such a function is e)3.542 F -.15(xe)-.15 G 1.042 +(cuted, a search is made through the directories in).15 F F1(FP)3.541 E -.95 +(AT)-.74 G(H).95 E F0(\(a)3.541 E .27 +(colon-separated list of directories similar to)72 350.4 R F1 -.74(PA)2.77 G +(TH)-.21 E F0 2.77(\)f)C .27(or a \214le with the same name as the function.) +285.78 350.4 R .27(That \214le)5.27 F .548(is then read in as with the)72 362.4 +R F1(.)3.881 E F0 .547(command; presumably the function is de\214ned therein.) +3.047 F .547(There is a pair of shell)5.547 F .886 +(functions included in the bash distrib)72 374.4 R .886(ution \()-.2 F F3 -.2 +(ex)C(amples/functions/autoload).2 E F0 5.886(\)t)C .886(hat pro)378.35 374.4 R +.886(vide much of this func-)-.15 F +(tionality without changing the shell itself.)72 386.4 Q .116 +(Ksh functions are scoped in such a w)97 402 R .116(ay that the en)-.1 F .116 +(vironment in which the)-.4 F 2.616(ya)-.15 G .116(re e)405.144 402 R -.15(xe) +-.15 G .115(cuted is closer to a).15 F .827(shell script en)72 414 R 3.327 +(vironment. Bash)-.4 F .827(uses the POSIX.2 scoping rules, which mak)3.327 F +3.327(et)-.1 G .827(he function e)392.517 414 R -.15(xe)-.15 G .828(cution en) +.15 F(vi-)-.4 E 1.2(ronment an e)72 426 R 1.2(xact cop)-.15 F 3.7(yo)-.1 G 3.7 +(ft)174.86 426 S 1.199(he shell en)184.67 426 R 1.199 +(vironment with the replacement of the shell')-.4 F 3.699(sp)-.55 G 1.199 +(ositional paramters)426.421 426 R(with the function ar)72 438 Q 2.5 +(guments. K)-.18 F +(orn shell functions do not share options or traps with the in)-.35 E -.2(vo) +-.4 G(king shell.).2 E .451(Ksh has)97 453.6 R F3(tr)2.951 E(ac)-.15 E -.1(ke) +-.2 G(d).1 E F0 .452(aliases, which alias a command name to its full pathname.) +2.952 F .452(Bash has true command)5.452 F(hashing.)72 465.6 Q F1 2.5 +(4.4.3. Arrays)72 489.6 R F0 .246 +(Arrays are an aspect of ksh that has no real bash equi)97 505.2 R -.25(va)-.25 +G 2.746(lent. The).25 F 2.746(ya)-.15 G .246(re easy to create and manipulate:) +371.42 505.2 R 1.637 +(an array is created automatically by using subscript assignment \()72 517.2 R +F1(name)A F0([)A F3(inde)A(x)-.2 E F0(]=)A F1 -.1(va)C(lue).1 E F0 1.637 +(\), and an)B 4.137(yv)-.15 G(ariable)476.79 517.2 Q 1.967 +(may be referred to as an array)72 529.2 R 6.967(.K)-.65 G 1.967(sh arrays, ho) +219.229 529.2 R(we)-.25 E -.15(ve)-.25 G 2.767 -.4(r, h).15 H -2.25 -.2(av e).4 +H(se)4.667 E -.15(ve)-.25 G 1.967(ral anno).15 F 1.967(ying limitations: the) +-.1 F 4.466(ym)-.15 G 1.966(ay be)480.654 529.2 R(inde)72 541.2 Q -.15(xe)-.15 +G 3.498(do).15 G .998(nly up to 512 or 1024 elements, depending on ho)111.858 +541.2 R 3.498(wt)-.25 G .999(he shell is compiled, and there is only the) +330.188 541.2 R(clumsy)72 553.2 Q F1 .223(set -A)2.723 F F0 .223 +(to assign a list of v)2.723 F .223(alues sequentially)-.25 F 5.223(.D)-.65 G +.223(espite these limits, arrays are useful, if underutilized)293.31 553.2 R +(by shell programmers.)72 565.2 Q F1 2.5(4.4.4. Builtin)72 589.2 R(Commands)2.5 +E F0 .112(Some of the b)97 604.8 R .112(uiltin commands ha)-.2 F .412 -.15 +(ve b)-.2 H .112(een e).15 F .112(xtended or are ne)-.15 F 2.612(wi)-.25 G +2.613(nk)351.402 604.8 S 2.613(sh. The)364.015 604.8 R F1(print)2.613 E F0 -.2 +(bu)2.613 G .113(iltin w).2 F .113(as included)-.1 F .242(to w)72 616.8 R .242 +(ork around the incompatibilities and limitations of)-.1 F F1(echo)2.741 E F0 +5.241(.T)C(he)328.234 616.8 Q F1(whence)2.741 E F0 .241(command tells what w) +2.741 F .241(ould hap-)-.1 F .418(pen if each ar)72 628.8 R .418 +(gument were typed as a command name.)-.18 F(The)5.418 E F1(cd)2.919 E F0 -.2 +(bu)2.919 G .419(iltin has been e).2 F .419(xtended to tak)-.15 F 2.919(eu)-.1 +G 2.919(pt)470.482 628.8 S 2.919(ot)481.181 628.8 S -.1(wo)491.88 628.8 S(ar)72 +640.8 Q 1.425(guments: if tw)-.18 F 3.925(oa)-.1 G -.18(rg)153.485 640.8 S +1.424(uments are supplied, the second is substituted for the \214rst in the cu\ +rrent directory).18 F 2.294 +(name and the shell changes to the resultant directory name.)72 652.8 R 2.295 +(The ksh)7.294 F F1(trap)4.795 E F0 -.2(bu)4.795 G 2.295(iltin accepts).2 F F1 +(ERR)4.795 E F0(and)4.795 E F1(DEB)72 664.8 Q(UG)-.1 E F0 .15(as trap names.) +2.65 F(The)5.15 E F1(ERR)2.65 E F0 .15(trap is e)2.65 F -.15(xe)-.15 G .15 +(cuted when a command f).15 F(ails;)-.1 E F1(DEB)2.65 E(UG)-.1 E F0 .15(is e) +2.65 F -.15(xe)-.15 G .15(cuted after e).15 F -.15(ve)-.25 G(ry).15 E +(simple command.)72 676.8 Q .05(The bash distrib)97 692.4 R .05 +(ution includes shell functions that implement)-.2 F F1(print)2.55 E F0(and) +2.55 E F1(whence)2.55 E F0 .05(and the e)2.55 F .05(xtensions to)-.15 F F1(cd) +72 704.4 Q F0(.)A EP +%%Page: 11 11 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 2.5(-1)277.17 48 S 2.5(1-)288 48 S/F1 10/Times-Bold@0 +SF 2.5(4.4.5. Expansion)72 84 R F0 .282(The ksh \214lename generation \()97 +99.6 R/F2 10/Times-Italic@0 SF(globbing)A F0 2.782(\)f)C .282(acilities ha) +262.45 99.6 R .581 -.15(ve b)-.2 H .281(een e).15 F .281(xtended be)-.15 F .281 +(yond their bash and sh coun-)-.15 F 3.68(terparts. In)72 111.6 R 1.181 +(this area, ksh can be thought of as)3.681 F F2 -.4(eg)3.681 G -.37(re).4 G(p) +.37 E F0 1.181(to the bash)5.347 F F2(gr)3.681 E(ep)-.37 E F0 6.181(.K)1.666 G +1.181(sh globbing of)382.406 111.6 R 1.181(fers things lik)-.25 F(e)-.1 E 1.018 +(alternation, the ability to match zero or more instances of a pattern, and th\ +e ability to match e)72 123.6 R 1.018(xactly one)-.15 F(occurrence of an)72 +135.6 Q 2.5(yo)-.15 G 2.5(fal)150.98 135.6 S(ist of patterns.)166.53 135.6 Q F1 +2.5(4.4.6. Startup)72 159.6 R(Files)2.5 E F0 .977(Ksh and bash e)97 175.2 R +-.15(xe)-.15 G .977(cute startup \214les dif).15 F(ferently)-.25 E 5.977(.K) +-.65 G .977(sh e)297.879 175.2 R(xpands)-.15 E F1(ENV)3.478 E F0 .978 +(and sources the \214le it names for)3.478 F -2.15 -.25(ev e)72 187.2 T 1.85 +(ry shell.).25 F 1.85(Bash sources)6.85 F F1($ENV)4.35 E F0 1.85 +(only in non-interacti)4.35 F 2.15 -.15(ve s)-.25 H 1.85(hells; interacti).15 F +2.15 -.15(ve s)-.25 H 1.85(hells source \214x).15 F 1.85(ed \214les, as)-.15 F +-.15(ex)72 199.2 S 1.285(plained in the pre).15 F 1.285(vious section.)-.25 F +1.285(The POSIX standard has speci\214ed the ksh beha)6.285 F(vior)-.2 E 3.785 +(,s)-.4 G 3.785(ob)441.545 199.2 S 1.285(ash acts the)455.33 199.2 R +(same as ksh if started with the)72 211.2 Q F1(\255posix)2.5 E F0(or)2.5 E F1 +(\255o posix)2.5 E F0(options.)2.5 E F1 2.5(4.4.7. History)72 235.2 R F0 +(Finally)97 250.8 Q 3.372(,t)-.65 G .872(he ksh history implementation dif) +133.342 250.8 R .871(fers slightly from bash.)-.25 F .871 +(Each instance of bash k)5.871 F .871(eeps the)-.1 F .633 +(history list in memory and of)72 262.8 R .633(fers options to the)-.25 F F1 +(history)3.133 E F0 -.2(bu)3.133 G .634 +(iltin to write the list to or read it from a named).2 F 3.216(\214le. Ksh)72 +274.8 R -.1(ke)3.216 G .716 +(eps the history in a \214le, which it accesses each time a command is sa).1 F +-.15(ve)-.2 G 3.215(dt).15 G 3.215(oo)426.445 274.8 S 3.215(rr)439.66 274.8 S +(etrie)449.535 274.8 Q -.15(ve)-.25 G 3.215(df).15 G(rom)487.89 274.8 Q .338 +(the history)72 286.8 R 5.338(.K)-.65 G .338 +(sh history \214les may be shared among dif)129.246 286.8 R .338 +(ferent concurrent instances of ksh, which could be a)-.25 F +(bene\214t to the user)72 298.8 Q(.)-.55 E F1 2.5(5. F)72 322.8 R(eatur)-.25 E +(es in Bash-2.0)-.18 E F0 .657(The ne)97 338.4 R .657 +(xt release of bash, 2.0, will be a major o)-.15 F -.15(ve)-.15 G 3.157 +(rhaul. It).15 F .656(will include man)3.157 F 3.156(yn)-.15 G 1.156 -.25(ew f) +419.532 338.4 T .656(eatures, for both).25 F .705(programming and interacti)72 +350.4 R 1.005 -.15(ve u)-.25 H 3.205(se. Redundant).15 F -.15(ex)3.205 G .705 +(isting functions will be remo).15 F -.15(ve)-.15 G 3.206(d. There).15 F .706 +(are se)3.206 F -.15(ve)-.25 G .706(ral cases).15 F 1.34(where bash treats a v) +72 362.4 R 1.34(ariable specially to enable functionality a)-.25 F -.25(va)-.2 +G 1.34(ilable another w).25 F 1.34(ay \()-.1 F F1($nolinks)A F0(vs.)3.84 E F1 +1.34(set -o)3.84 F(ph)72 374.4 Q(ysical)-.15 E F0 2.5(,f)C(or e)115.19 374.4 Q +(xample\); the special treatment of the v)-.15 E(ariable name will be remo)-.25 +E -.15(ve)-.15 G(d.).15 E F1 2.5(5.1. Arrays)72 398.4 R F0 .546(Bash-2.0 will \ +include arrays which are a superset of those in ksh, with the size limitations\ + remo)97 414 R -.15(ve)-.15 G(d.).15 E(The)72 426 Q F1(declar)3.086 E(e)-.18 E +F0(,)A F1 -.18(re)3.086 G(adonly).18 E F0 3.086(,a)C(nd)174.768 426 Q F1 +(export)3.086 E F0 -.2(bu)3.086 G .586 +(iltins will accept options to specify arrays, and the).2 F F1 -.18(re)3.085 G +(ad).18 E F0 -.2(bu)3.085 G .585(iltin will).2 F(ha)72 438 Q .81 -.15(ve a)-.2 +H 3.01(no).15 G .51(ption to read a list of w)110.99 438 R .51 +(ords and assign them directly to an array)-.1 F 5.51(.T)-.65 G .51 +(here will also be a ne)386.23 438 R 3.01(wa)-.25 G(rray)487.9 438 Q F2 .262 +(compound assignment)72 450 R F0 .262(syntax a)2.762 F -.25(va)-.2 G .262 +(ilable for assignment statements and the).25 F F1(declar)2.761 E(e)-.18 E F0 +-.2(bu)2.761 G 2.761(iltin. This).2 F(ne)2.761 E 2.761(ws)-.25 G(yntax)481.78 +450 Q .441(has the form)72 462 R F2(name)2.941 E F0(=\()A F2(value1)A F0(...) +2.941 E F2(valueN)2.941 E F0 .441(\), where each)B F2(value)2.942 E F0 .442 +(has the form [)4.608 F F2(subscript)A F0(]=)A F2(string)A F0 5.442(.O)C .442 +(nly the)449.776 462 R F2(string)2.942 E F0 1.395(is required.)72 474 R 1.395 +(If the optional brack)6.395 F 1.395(ets and)-.1 F F2(subscript)3.894 E F0 +1.394(are included, that inde)3.894 F 3.894(xi)-.15 G 3.894(sa)388.714 474 S +1.394(ssigned to, otherwise the)400.938 474 R(inde)72 486 Q 3.656(xo)-.15 G +3.656(ft)102.726 486 S 1.156(he element assigned is the last inde)112.492 486 R +3.657(xa)-.15 G 1.157(ssigned to by the statement plus one.)272.917 486 R(Inde) +6.157 E 1.157(xing starts at)-.15 F 2.73(zero. The)72 498 R .23 +(same syntax is accepted by)2.73 F F1(declar)2.73 E(e)-.18 E F0 5.229(.I)C(ndi) +269.159 498 Q .229(vidual array elements may be assigned to using the ksh)-.25 +F F2(name)72 510 Q F0([)A F2(subscript)A F0(]=)A F2(value)A F0(.)A F1 2.5 +(5.2. Dynamic)72 534 R(Loading)2.5 E F0 .348(On systems that support the)97 +549.6 R F2(dlopen)2.848 E F0 .349(\(3\) library function, bash-2.0 will allo)B +2.849(wn)-.25 G .849 -.25(ew b)407.504 549.6 T .349(uiltins to be loaded).05 F +.049(into a running shell from a shared object \214le.)72 561.6 R .049(The ne) +5.049 F 2.549(wb)-.25 G .049(uiltins will ha)298.999 561.6 R .348 -.15(ve a)-.2 +H .048(ccess to the rest of the shell f).15 F(acil-)-.1 E .649(ities, b)72 +573.6 R .649(ut programmers will be subject to a fe)-.2 F 3.149(ws)-.25 G .649 +(tructural rules.)269.591 573.6 R .65(This will be pro)5.65 F .65 +(vided via a ne)-.15 F 3.15(wo)-.25 G .65(ption to)472.51 573.6 R F1(enable)72 +585.6 Q F0(.)A F1 2.5(5.3. Builtins)72 609.6 R F0 .889(Some of the e)97 625.2 R +.889(xisting b)-.15 F .889(uiltins will change in bash-2.0.)-.2 F .888(As pre) +5.888 F .888(viously noted,)-.25 F F1(declar)3.388 E(e)-.18 E F0(,)A F1(export) +3.388 E F0(,)A F1 -.18(re)3.388 G(ad-).18 E(only)72 637.2 Q F0 2.873(,a)C(nd) +100.153 637.2 Q F1 -.18(re)2.873 G(ad).18 E F0 .373(will accept ne)2.873 F +2.873(wo)-.25 G .374(ptions to specify arrays.)206.288 637.2 R(The)5.374 E F1 +(jobs)2.874 E F0 -.2(bu)2.874 G .374(iltin will be able to list only stopped).2 +F .323(or running jobs.)72 649.2 R(The)5.322 E F1(enable)2.822 E F0 .322 +(command will tak)2.822 F 2.822(ean)-.1 G -.25(ew)282.84 649.2 S F1<ad73>3.072 +E F0 .322(option to restrict its actions to the POSIX.2)2.822 F F2(spe-)2.822 E +(cial)72 661.2 Q F0 -.2(bu)3.14 G(iltins.).2 E F1(Kill)5.64 E F0 .64 +(will be able to list signal numbers corresponding to indi)3.14 F .64 +(vidual signal names.)-.25 F .64(The read-)5.64 F .703(line library interf)72 +673.2 R(ace,)-.1 E F1(bind)3.203 E F0 3.203(,w)C .703(ill ha)193.032 673.2 R +1.003 -.15(ve a)-.2 H 3.203(no).15 G .703(ption to remo)243.951 673.2 R 1.003 +-.15(ve t)-.15 H .703(he binding for an).15 F 3.203(yk)-.15 G 1.002 -.15(ey s) +398.032 673.2 T .702(equence \(which is not).15 F +(the same as binding it to self-insert\).)72 685.2 Q .494(There will be tw)97 +700.8 R 2.994(on)-.1 G .994 -.25(ew b)177.196 700.8 T .495 +(uiltin commands in bash-2.0.).05 F(The)5.495 E F1(diso)2.995 E(wn)-.1 E F0 +.495(command will remo)2.995 F .795 -.15(ve j)-.15 H .495(obs from).15 F(bash') +72 712.8 Q 3.445(si)-.55 G .945(nternal jobs table when job control is acti) +103.225 712.8 R -.15(ve)-.25 G 5.945(.A).15 G(diso)303.25 712.8 Q .944 +(wned job will not be listed by the jobs com-)-.25 F .666(mand, nor will its e) +72 724.8 R .666(xit status be reported.)-.15 F(Diso)5.667 E .667 +(wned jobs will not be sent a)-.25 F F1(SIGHUP)3.167 E F0 .667 +(when an interacti)3.167 F -.15(ve)-.25 G EP +%%Page: 12 12 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 2.5(-1)277.17 48 S 2.5(2-)288 48 S .688(shell e)72 84 R +3.187(xits. Most)-.15 F .687(of the shell')3.187 F 3.187(so)-.55 G .687 +(ptional or)205.423 84 R/F1 10/Times-Italic@0 SF(to)3.187 E -.1(gg)-.1 G(led).1 +E F0 .687(functionality will be folded into the ne)3.187 F(w)-.25 E/F2 10 +/Times-Bold@0 SF(shopt)3.187 E F0 -.2(bu)3.187 G(iltin.).2 E(Man)72 96 Q 3.714 +(yo)-.15 G 3.714(ft)103.894 96 S 1.214(he v)113.718 96 R 1.214 +(ariables which alter the shell')-.25 F 3.714(sb)-.55 G(eha)266.282 96 Q 1.214 +(vior when set \(re)-.2 F -.05(ga)-.15 G 1.214(rdless of their v).05 F 1.215 +(alue\) will be made)-.25 F 6(options settable with)72 108 R F2(shopt)8.5 E F0 +11(.E)C 6(xamples of such v)218.23 108 R 6(ariables include)-.25 F F2(allo)8.5 +E(w_null_glob_expansion)-.1 E F0(,)A F2(glob_dot_\214lenames)72 120 Q F0 2.5 +(,a)C(nd)163.67 120 Q F2(MAIL_W)2.5 E(ARNING)-1.2 E F0(.)A F2 2.5(5.4. V)72 144 +R(ariables and V)-.92 E(ariable Expansion)-.92 E F0 .047 +(Bash-2.0 will implement se)97 159.6 R -.15(ve)-.25 G .048(ral ne).15 F 2.548 +(wv)-.25 G .048(ariable e)252.988 159.6 R 2.548(xpansions. These)-.15 F .048 +(will answer se)2.548 F -.15(ve)-.25 G .048(ral of the most per).15 F(-)-.2 E +.213(sistant requests for ne)72 171.6 R 2.713(wf)-.25 G 2.713(eatures. It) +172.582 171.6 R .213(will be possible to `)2.713 F .212(`indirectly reference') +-.74 F 2.712('av)-.74 G .212(ariable with an e)398.534 171.6 R(xpansion,)-.15 E +(lik)72 183.6 Q 3.01(eu)-.1 G(sing)94.91 183.6 Q/F3 10/Courier@0 SF .51 +(eval \\$${name})3.01 F F0 .51(to reference a v)3.01 F .51(ariable named by) +-.25 F F3(${name})3.01 E F0 5.51(.E)C .51(xpansions will be a)394.32 183.6 R +-.25(va)-.2 G(ilable).25 E .462(to retrie)72 195.6 R .762 -.15(ve s)-.25 H .462 +(ubstrings of v).15 F .461(ariables in an)-.25 F F1(awk)2.961 E F0(-lik)A 2.961 +(em)-.1 G .461(anner: starting at a speci\214c inde)277.692 195.6 R .461 +(x, retrie)-.15 F .461(ving some num-)-.25 F .941 +(ber of characters or the rest of the string.)72 207.6 R .941 +(It will be possible to retrie)5.941 F 1.241 -.15(ve s)-.25 H .941 +(equences of array elements lik).15 F(e)-.1 E .354(this, too.)72 219.6 R .354 +(It w)5.354 F .354(ould be nice to ha)-.1 F .654 -.15(ve a w)-.2 H .354 +(ay to replace portions of a v).05 F .353 +(ariable matching a pattern the same w)-.25 F(ay)-.1 E(leading or trailing sub\ +strings are presently stripped; that capability may be a)72 231.6 Q -.25(va)-.2 +G(ilable.).25 E .453(Another ne)97 247.2 R 2.953(we)-.25 G .453 +(xpansion will pro)156.376 247.2 R .453(vide a w)-.15 F .454 +(ay to create strings containing arbitrary characters, which is)-.1 F(incon)72 +259.2 Q -.15(ve)-.4 G 1.636(nient in the current v).15 F 4.136(ersion. W)-.15 F +1.635(ords of the form $')-.8 F F1(string)A F0 4.135('w)C 1.635(ill e)355.145 +259.2 R 1.635(xpand to)-.15 F F1(string)4.135 E F0 1.635(with backslash-)4.135 +F 1.231(escaped characters in)72 271.2 R F1(string)3.731 E F0 1.231 +(replaced as speci\214ed by the ANSI C standard.)3.731 F 1.232 +(As with other single-quoted)6.232 F +(shell strings, the only character that may not appear in)72 283.2 Q F1(string) +2.5 E F0(is a single quote.)2.5 E 1.436(The shell v)97 298.8 R 1.436 +(ariables will change also.)-.25 F 3.936(An)6.436 G 1.936 -.25(ew va)272.052 +298.8 T(riable).25 E F2(HISTIGNORE)3.936 E F0 1.435(will supersede)3.936 F F2 +(HISTCON-)3.935 E(TR)72 310.8 Q(OL)-.3 E F0(.)A F2(HISTIGNORE)5.327 E F0 .327 +(is the history analogy of)2.827 F F2(FIGNORE)2.828 E F0 2.828(:ac)C .328 +(olon-separated list of patterns specifying)339.938 310.8 R 1.082 +(commands to omit from the history list.)72 322.8 R 1.081 +(The special pattern '&' will match the pre)6.081 F 1.081 +(vious history line, to)-.25 F(pro)72 334.8 Q 1.568(vide the)-.15 F F2 +(HISTCONTR)4.068 E(OL)-.3 E F1(ignor)4.068 E(edups)-.37 E F0(beha)5.734 E(vior) +-.2 E 6.568(.M)-.55 G(an)303.546 334.8 Q 4.069(yv)-.15 G 1.569 +(ariables which modify the shell')326.655 334.8 R 4.069(sb)-.55 G(eha)474.21 +334.8 Q(vior)-.2 E .395(will lose their special meaning.)72 346.8 R -1.11(Va) +5.395 G .395(riables such as)1.11 F F2(notify)2.895 E F0(and)2.895 E F2(noclob) +2.895 E(ber)-.1 E F0 .395(which pro)2.895 F .395(vide functionality a)-.15 F +-.25(va)-.2 G(il-).25 E .931 +(able via other mechanisms will no longer be treated specially)72 358.8 R 5.931 +(.O)-.65 G .931(ther v)340.06 358.8 R .932(ariables will be folded into)-.25 F +F2(shopt)3.432 E F0(.)A(The)72 370.8 Q F2(history_contr)5.519 E(ol)-.18 E F0 +(and)5.519 E F2(hostname_completion_\214le)5.519 E F0 -.25(va)5.519 G 3.019 +(riables, superseded by).25 F F2(HISTCONTR)5.518 E(OL)-.3 E F0(and)5.518 E F2 +(HOSTFILE)72 382.8 Q F0(respecti)2.5 E -.15(ve)-.25 G(ly).15 E 2.5(,w)-.65 G +(ill be remo)185.12 382.8 Q -.15(ve)-.15 G(d.).15 E F2 2.5(5.5. Readline)72 +406.8 R F0(Naturally)97 422.4 Q 2.94(,t)-.65 G .44(here will be impro)142.34 +422.4 R -.15(ve)-.15 G .441(ments to readline as well.).15 F .441 +(All of the POSIX.2)5.441 F F1(vi)2.941 E F0 .441(-mode editing com-)B .33 +(mands will be implemented; missing commands lik)72 434.4 R 2.829(e`)-.1 G .329 +(m' to sa)290.599 434.4 R .629 -.15(ve t)-.2 H .329 +(he current cursor position \().15 F F1(mark)A F0 2.829(\)a)C .329(nd the) +478.951 434.4 R .36(`@' command for macro e)72 446.4 R .36(xpansion will be a) +-.15 F -.25(va)-.2 G 2.861(ilable. The).25 F .361 +(ability to set the mark and e)2.861 F .361(xchange the current)-.15 F .764 +(cursor position \()72 458.4 R F1(point)A F0 3.264(\)a)C .764 +(nd mark will be added to the readline emacs mode as well.)170.672 458.4 R .763 +(Since there are com-)5.764 F .196 +(mands to set the mark, commands to manipulate the re)72 470.4 R .197 +(gion \(the characters between the point and the mark\))-.15 F .111(will be a) +72 482.4 R -.25(va)-.2 G 2.611(ilable. Commands).25 F(ha)2.611 E .411 -.15 +(ve b)-.2 H .11 +(een added to the readline emacs mode for more complete ksh compati-).15 F +(bility)72 494.4 Q 2.5(,s)-.65 G(uch as the C-])101.36 494.4 Q F1(c)A F0 +(character search command.)2.5 E F2 2.5(5.6. Con\214guration)72 518.4 R F0 .318 +(Bash w)97 534 R .318 +(as the \214rst GNU program to completely autocon\214gure.)-.1 F .319 +(Its autocon\214guration mechanism pre-)5.319 F(dates)72 546 Q F1(autoconf)4.07 +E F0 4.07(,t)C 1.569 +(he current GNU con\214guration program, and needs updating.)140.97 546 R 1.569 +(Bash-2.0 may include an)6.569 F .603 +(autoconf-based con\214guration script, if necessary ne)72 558 R 3.103(wf)-.25 +G .603(unctionality can be added to autoconf, or its limita-)294.476 558 R +(tions bypassed.)72 570 Q F2 2.5(5.7. Miscellaneous)72 594 R F0 1.632 +(The POSIX mode will be impro)97 609.6 R -.15(ve)-.15 G 4.131(di).15 G 4.131 +(nb)254.26 609.6 S 1.631(ash-2.0; it will pro)268.391 609.6 R 1.631 +(vide a more complete superset of the)-.15 F(POSIX standard.)72 621.6 Q -.15 +(Fo)5 G 2.5(rt).15 G(he \214rst time, bash will recognize the e)163.79 621.6 Q +(xistance of the POSIX.2)-.15 E F1(special)2.5 E F0 -.2(bu)2.5 G(iltins.).2 E +2.627(An)97 637.2 S .627 -.25(ew t)111.847 637.2 T .127(rap v).25 F(alue,)-.25 +E F2(DEB)2.627 E(UG)-.1 E F0 2.627(,w)C .128(ill be present, as in ksh.)218.405 +637.2 R .128(Commands speci\214ed with a)5.128 F F2(DEB)2.628 E(UG)-.1 E F0 +.128(trap will)2.628 F 1.908(be e)72 649.2 R -.15(xe)-.15 G 1.908 +(cuted after e).15 F -.15(ve)-.25 G 1.908(ry simple command.).15 F 1.908 +(Since this mak)6.908 F 1.908(es shell script deb)-.1 F 1.908 +(uggers possible, I hope to)-.2 F(include a bash deb)72 661.2 Q +(ugger in the bash-2.0 release.)-.2 E F2 2.5(6. A)72 685.2 R -.1(va)-1 G +(ilability).1 E F0 5.997(The current v)97 700.8 R 5.997(ersion of bash is a) +-.15 F -.25(va)-.2 G 5.998(ilable for anon).25 F 5.998 +(ymous FTP from prep.ai.mit.edu as)-.15 F F1(/pub/gnu/bash-1.14.2.tar)72 712.8 +Q(.gz)-1.11 E F0(.)1.666 E EP +%%Page: 13 13 +%%BeginPageSetup +BP +%%EndPageSetup +/F0 10/Times-Roman@0 SF 2.5(-1)277.17 48 S 2.5(3-)288 48 S/F1 10/Times-Bold@0 +SF 2.5(7. Conclusion)72 84 R F0 .755(This paper has presented an o)97 99.6 R +-.15(ve)-.15 G(rvie).15 E 3.255(wo)-.25 G 3.255(fb)259.27 99.6 S .755 +(ash, compared its features with those of other shells, and)270.855 99.6 R +(hinted at features in the ne)72 111.6 Q(xt release, bash-2.0.)-.15 E .483 +(Bash is a solid replacement for sh.)97 127.2 R .483(It is suf)5.483 F .483 +(\214ciently portable to run on nearly e)-.25 F -.15(ve)-.25 G .484(ry v).15 F +.484(ersion of)-.15 F/F2 9/Times-Roman@0 SF(UNIX)2.984 E F0 .514 +(from 4.3 BSD to SVR4.2, and se)72 139.2 R -.15(ve)-.25 G(ral).15 E F2(UNIX) +3.013 E F0 -.1(wo)3.013 G(rkalik).1 E .513(es, and rob)-.1 F .513 +(ust enough to replace sh on most of those)-.2 F .771(systems, It is v)72 151.2 +R .771(ery close to POSIX.2-conformant in POSIX mode, and is getting f)-.15 F +(aster)-.1 E 5.771(.I)-.55 G 3.272(ti)436.684 151.2 S 3.272(sn)445.516 151.2 S +.772(ot, unfortu-)457.678 151.2 R(nately)72 163.2 Q 2.663(,g)-.65 G .163 +(etting smaller)105.953 163.2 R 2.663(,b)-.4 G .163(ut there are man)170.399 +163.2 R 2.663(yo)-.15 G .163(ptional features.)248.101 163.2 R .163(It is v) +5.163 F .162(ery easy to b)-.15 F .162(uild a small subset to use as)-.2 F 2.5 +(ad)72 175.2 S(irect replacement for /bin/sh.)83.94 175.2 Q .909 +(Bash has thousands of users w)97 190.8 R .909(orldwide, all of whom ha)-.1 F +1.209 -.15(ve h)-.2 H .91(elped to mak).15 F 3.41(ei)-.1 G 3.41(tb)409.34 190.8 +S(etter)420.53 190.8 Q 5.91(.A)-.55 G .91(nother testa-)453.38 190.8 R +(ment to the bene\214ts of free softw)72 202.8 Q(are.)-.1 E F1 2.5(8. Refer)72 +226.8 R(ences)-.18 E F0 .432([1] S. R. Bourne, `)72 242.4 R .432(`UNIX T)-.74 F +.432(ime-Sharing System:)-.35 F .431(The UNIX Shell')5.431 F(',)-.74 E/F3 10 +/Times-Italic@0 SF .431(Bell System T)2.931 F(ec)-.92 E .431(hnical J)-.15 F +(ournal)-.25 E F0 2.931(,5)C(7\(6\),)484.84 242.4 Q +(July-August, 1978, pp. 1971-1990.)72 254.4 Q .736([2] Morris Bolsk)72 270 R +3.237(ya)-.15 G .737(nd Da)153.22 270 R .737(vid K)-.2 F(orn,)-.35 E F3 .737 +(The K)3.237 F .737(ornShell Command and Pr)-.4 F -.1(og)-.45 G -.15(ra).1 G +.737(mming Langua).15 F -.1(ge)-.1 G F0 3.237(,P).1 G .737(rentice Hall,) +453.833 270 R(1989.)72 282 Q .142([3] Bill Jo)72 297.6 R 1.442 -.65(y, A)-.1 H +2.642(nI).65 G .141(ntroduction to the C Shell,)140.428 297.6 R F3 .141 +(UNIX User')2.641 F 2.641(sS)-.4 G .141(upplementary Documents)309.346 297.6 R +F0 2.641(,U)C(ni)424.328 297.6 Q -.15(ve)-.25 G .141(rsity of Califor).15 F(-) +-.2 E(nia at Berk)72 309.6 Q(ele)-.1 E 1.3 -.65(y, 1)-.15 H(986.).65 E .283 +([4] IEEE,)72 325.2 R F3 .283(IEEE Standar)2.783 F 2.783(df)-.37 G .283 +(or Information T)179.692 325.2 R(ec)-.92 E(hnolo)-.15 E .283(gy -- P)-.1 F +.283(ortable Oper)-.8 F .283(ating System Interface \(POSIX\) P)-.15 F(art)-.8 +E(2: Shell and Utilities)72 337.2 Q F0 2.5(,1)C(992.)165.06 337.2 Q F1 2.5 +(9. A)72 361.2 R(uthor Inf)-.5 E(ormation)-.25 E F0 .937(Chet Rame)97 376.8 R +3.437(yi)-.15 G 3.437(sas)153.724 376.8 S(oftw)172.818 376.8 Q .936 +(are engineer w)-.1 F .936(orking at Case W)-.1 F .936(estern Reserv)-.8 F +3.436(eU)-.15 G(ni)393.43 376.8 Q -.15(ve)-.25 G(rsity).15 E 5.936(.H)-.65 G +3.436(eh)443.036 376.8 S .936(as a B.S. in)455.912 376.8 R .072 +(Computer Engineering and an M.S. in Computer Science, both from CWR)72 388.8 R +2.573(U. He)-.4 F .073(has been w)2.573 F .073(orking on bash)-.1 F +(for six years, and the primary maintainer for one.)72 400.8 Q EP +%%Trailer +end +%%EOF diff --git a/doc/version.texi b/doc/version.texi index 0ca20b1..f769a19 100644 --- a/doc/version.texi +++ b/doc/version.texi @@ -1,10 +1,10 @@ @ignore -Copyright (C) 1988-2004 Free Software Foundation, Inc. +Copyright (C) 1988-2005 Free Software Foundation, Inc. @end ignore -@set EDITION 3.0 -@set VERSION 3.0 -@set UPDATED 27 July 2004 -@set UPDATED-MONTH July 2004 +@set LASTCHANGE Mon Sep 5 11:47:04 EDT 2005 -@set LASTCHANGE Tue Jul 27 09:12:07 EDT 2004 +@set EDITION 3.1-beta1 +@set VERSION 3.1-beta1 +@set UPDATED 5 September 2005 +@set UPDATED-MONTH September 2005 |
