/
Bash Bash

Bash - PDF document

alexa-scheidler
alexa-scheidler . @alexa-scheidler
Follow
400 views
Uploaded On 2016-02-23

Bash - PPT Presentation

2c89the POSIX2 version ofcc andyaccBash is concerned with the aspects of the shellvior de ID: 228677

-2-c89(the POSIX.2 version ofcc) andyacc.Bash

Share:

Link:

Embed:

Download Presentation from below link

Download Pdf The PPT/PDF document "Bash " is the property of its rightful owner. Permission is granted to download and print the materials on this web site for personal, non-commercial use only, and to display it on your personal computer provided you do not modify the materials and that you retain all copyright notices contained in the materials. By downloading content from our website, you accept the terms of this agreement.


Presentation Transcript

Bash ­ The GNU shell*Chet RameyCase Western Reserve University1. IntroductionBashis the shell, or command language interpreterThe name is an acronym for the ™Bourne-Again SHellš, a pun on Steve Bourne, the author of the directancestor of the currentUNIX/bin/shhich appeared in the Seer-sion ofUNIX.Bash is ansh­compatible shell that incorporates useful features from the Korn shell (kshshell (csh), described later in this article.It is ultimately intended to be a conformant implementation of theIEEE POSIX Shell and Utilities speciŒcation (IEEE Working Group 1003.2).It offers functionalimproments ohfve and programming use.While the GNU operating system will most likely include a version of the Berkelehell csh, Bashwill be the default shell.Likare, Bash is quite portable.It currently runs on nearly ersion ofUNIXand a fexists for OS/2, andthere are rumors of ports to DOS and Windows NTUNIX-likare part of the distribution.The original author of Bash was Brian Fox, an employee of the Free Software Foundation. Thecur-rent dey, a volunteer who works at Case Western Reserv.2. What'OSIX, anyway?POSIXis a name originally coined by Richard Stallman for a family of open system standards basedonUNIXhere are a number of aspects ofUNIXunder consideration for standardization, from the basicsystem services at the system call and C library leoamanagement. Eacharea of standardization is assigned to a working group in the 1003 series.The POSIX Shell and Utilities standard has been deorking Group 1003.2(POSIX.2).ˆ It concentrates on the command interpreter interface and utility programs commonly efrom the command line or by other programs.An initial version of the standard has been appropublished by the IEEE, and work is currently underway to update it.There are four primary areas of workin the 1003.2 standard:spects of the shell'uiltins such ascdandexecare being speciŒed as part of the shell, since their functionality usually cannot be implementedby a separate eset of utilities to be called by shell scripts and applications.Examples are programs likesed, tr,andawk.Utilities commonly implemented as shell builtins are described in this section, such astestandkillxpansion of this section'cope, termed the User Portability Extension, or UPE, hasstandardized interactive programs such asviandmailx;group of functional interfaces to services provided by the shell, such as the traditionalsystem()ibrary function.There are functions to perform shell word expansions, perform Œlename expan-sion (globbing), obtain values of POSIX.2 system conŒguration variables, retrieve values of environ-ment variables (getenv()), and other services;*An earlier version of this article appeared in The Linux Journal.ˆIEEE,IEEE Standarechnology -- Portable Operating System Interface (POSIX) Part 2:Shell and Utilities -2-c89(the POSIX.2 version ofcc), andyacc.Bash is concerned with the aspects of the shell'vior deŒned by POSIX.2.The shell commandlanguage has of course been standardized, including the basic oontrol and program estructs, I/O redirection and pipelining, argument handling, variable expansion, and quoting.Thespecialiltins, which must be implemented as part of the shell to provide the desired functionalityas being part of the shell; examples of these areev alexportther utilities appear in the sections ofPOSIX.2 not deuiltincommands, such asandtestve bvior as partof the UPE, including job control and command line editing.Interestingly enough, onlyvi-style line edit-ing commands have been standardized;emacsediting commands were left out due to objections.While POSIX.2 includes much of what the shell has traditionally provided, some important thingshave been omitted as being ™beyond its scope.here is, for instance, no mention of a difference between aloginshell and anve shell (since POSIX.2 does not specify a login program).No Œxedstartup Œles are deŒned, either ­ the standard does not mention.proŒle.3. BasicBash featuresSince the Bourne shell provides Bash with most of its philosophical underpinnings, Bash inheritsmost of its features and functionality from sh.Bash implements all of the traditional sh ostructs (for,if,whiletc.). Allof the Bourne shell builtins, including those not speciŒed in the POSIX.2standard, appear in Bash.Shellfunctionsersion of the Bourne shell, are similarto shell scripts, but are deŒned using a special syntax and are eshell. Bashhas shell functions which behave iashion upward-compatible with sh functions.There arecertain shell variables that Bash interprets in the same way as sh, such asPS1,IFSimplements essentially the same grammararameter and variable expansion semantics, redirection, andquoting as the Bourne shell.Where differences appear between the POSIX.2 standard and traditional shbehaviorash follows POSIX.The Korn Shell (kshsadT&T Bell Laboratories byDavid Korn‡. Itprovides a number of useful features that POSIX and Bash have adopted. Manftinteractive facilities in POSIX.2 have their roots in the ksh: for example, the POSIX and ksh job controlcilities are nearly identical. Bash includes features from the Korn Shell for both interactive use and shellprogramming. For programming, Bash provides variables such asRANDOMandREPLYtypesetiltin, the ability to remove substrings from variables based on patterns, and shell arithmetic.RANDOMpands to a random number each time it is referenced; assigning a value toRANDOMseeds the randomnumber generator.REPLYis the default variable used by theariable names are sup-plied as arguments. Thetypesetiltin is used to deŒne variables and give them attributes such asonlyash arithmetic allows the eluation of an expression and the substitution of the result.Shell vari-ables may be used as operands, and the result of an expression may be assigned to a variable. Nearlyall ofthe operators from the C language are a163ve use, Bash implements ksh-style aliases and builtins such asfc(discussed below) andjobs.Bash aliases alloThefor aUNIXcommand name (alias del=rm), to expand a single word to a complealiasnews='xterm -g 80x45 -title trn -e trn -e -S1 -N &'), or to ensure that a commandis inalias ls="/bin/ls -F").The C shell (csh)‡, originally written by Bill Johile at Berkeley, iidely used and quite popularfor its interactive facilities. Bashincludes a csh-compatible history expansion mechanism (™! historyš),brace expansion, access to a stack of directories via thepushd,popddirsxpansion,to generate users' home directories.lde expansion has also been adopted by both the Korn Shell and‡Morris Bolskvid Korn,The KornShell Command and Pr -3-POSIX.2.There were certain areas in which POSIX.2 felt standardization was necessaryxisting imple-mentation provided the proper behaviororking group inthese areas, which Bash implements.Thecommandas inwritten to replace builtins; it makes the capabilities of the builtin aThe reservedrd ™!š was added to nealue of a command or pipeline; it was nearly impossible topress ™if not xš cleanly using the sh language.There exist multiple incompatible implementations of thetestiltin, which tests Œles for type and other attributes and performs arithmetic and string comparisons.POSIX considered none of these correct, so the standard behavior was speciŒed in terms of the number ofarguments to the command.POSIX.2 dictates exactly what will happen when four or fewer arguments aregiond leavior undeŒned when more arguments are supplied.Bash uses thePOSIX.2 algorithm, which was conceiyDorn.3.1. Features not in the Bourne ShellThere are a number of minor differences between Bash and the version of sh present on most otherrsions ofUNIXhe majority of these are due to the POSIX standard, but some are the result of Bashadopting features from other shells.ed word, thecommandiltin, the ability of theiltin to correctly return a line ending with a backslash, symbolic argumentsto theumaskariable substring remoay to get the length of a variable, and the nerithm for thetestBash also implements the ™$(...)š command substitution syntax, which supersedes the sh `...` con-struct. The™$(...)š construct expands to the output of the command contained within the parentheses, withtrailing newlines remod. Thesh syntax is accepted for backwards compatibilitypreferred because its quoting rules are much simpler and it is easier to nest.The Bourne shell does not provide such features as brace expansion, the ability to deŒne a variableand a function with the same name, local variables in shell functions, the ability to enable and disable indi-vidual builtins or write a function to replace a builtin, or a means to export a shell function to a child pro-cess.Bash has closed a long-standing shell security hole by not using the$IFSordread by the shell, but splitting only the results of expansion (ksh and the 4.4 BSD sh have Œxehis aswell). Usefulbehavior such as a means to abort eommand using theniltin or automatically exporting variables in the shell'in the Bourne shell.Bash provides a much more powerful environment for both interactive use and pro-gramming.4. Bash-speciŒcFeesThis section details a feftMost of them provide improdve use, but a feFull descriptions of these fea-tures can be found in the Bash documentation.4.1. StartupFilesBash eferently than other shells.The Bash behavior is a compromise betweenthe csh principle of startup Œles with Œxed names evior.An interactive instance of Bash started as a login shell reads and e~/.bash_proŒle(the Œle.bash_proŒle in the user'ome directory), if it exists. Aninteractive non-login shell reads and e~/.bashrcve shell (one begun to example) reads no Œxed startupŒle, but uses the value of the variable$ENVfset, as the name of a startup Œle.The ksh practice of read-ing$ENVfor eying difŒculty of deŒning the proper variables and functionsfor interactive and non-interactive shells or having the Œle read only for interactive shells, was consideredtoo complex. Easeof use won out here.Interestinglyxt release of ksh will change to reading$ENV‡Bill Joy, Antroduction to the C Shell,UNIX User'Berkeley, 1 -4-only for interactive s4.2. NewBuiltin CommandsThere are a ferhav ebeen extended in Bash.Theenablewsiltin commands to be turned on and ofersion ofechofound in a user'path rather than the Bash builtin,enable -n echosufŒces. Thehelpiltin provides quick synopsesof the shell facilities without requiring access to a manual page.Builtinis similar tocommandin that itbypasses shell functions and directly euiltin commands.Access to a csh-style stack of directoriesis provided via thepushd,popddirsPushdandpopdinsert and remove directories from thestack, respectidirslists the stack contents.On systems that allone-grained control ofresources, theulimitUlimitallows a user to control, amongother things, whether core dumps are to be generated, hoallowed to allocate, and hoge a Œle created by a child process can grow. Tsuspendcommand willstop the shell process when job control is actiost other shells do not alloes to be stoppedlikthe Bash answer towhichandwhence,shows what will happen when a word is typed as acommand:ype exportexport is a shell builtinbuiltinbash is /bin/bashcd is a functionbuiltin cd ${1+"$@"} && xtitle $HOST: $PWD}rious modes tell what a command word is (reserved word, alias, function, builtin, or Œle) or which ver-sion of a command will be eSome of this functionality has beenadopted by POSIX.2 and folded into thecommandutility.4.3. Editingand CompletionOne area in which Bash shines is command line editing.Bash uses thelibrary to read andedit lines when interactiwerful and exible input facility that a user can conŒgure toindividual tastes.It allows lines to be edited using either emacs or vi commands, where those commandsare appropriate.The full capability of emacs is not present ­ there is no way to ewith M-x, for instance ­ but the existing commands are more than adequate.The vi mode is compliantwith the command line editing standardized by POSIX.2.Readline is fully customizable.In addition to the basic commands and key bindings, the libraryallows users to deŒne additional key bindings using a startup Œle.TheinputrcŒle, which defaults to the Œle~/.inputrcsread each time readline initializes, permitting users to maintain a consistent interface across aset of programs.Readline includes an extensible interface, so each program using the library can add itsindable commands and program-speciŒc key bindings. Bashuses this facility to add bindings thatperform history expansion or shell word expansions on the current input line.Readline interprets a number of variables which further tune its behaviorxist to controlwhether or not eight-bit characters are directly read as input or conrted to meta-preŒxed key sequences (ameta-preŒxed key sequence consists of the character with the eighth bit zeroed, preceded by themeta-preŒxcharactersually escape, which selects an alternate kmap), to decide whether to output characters withthe eighth bit set directly or as a meta-preŒxed key sequence, whether or not to wrap to a newhen a line being edited is longer than the screen width, the key bshould applyreants to ring the terminal'ell. Allof these variables -5-can be set in the inputrc Œle.The startup Œle understands a set of C preprocessor-likonditional constructs which alloor key bindings to be assigned based on the application using readline, the terminal currently being used, orthe editing mode.Users can add program-speciŒc bindings to makasier: Ihave bindings thatlet me edit the value of$PHvious word:$if Bash"\C-xp": "PATH=${PATH}\e\C-e\C-a\ef\C-f""\C-x\"": "\"\"\C-b""\C-xq": "\eb\"\ef\""There is a readline command to re-read the Œle, so users can edit the Œle, change some bindings, and beginto use them almost immediately.Bash implements thebindBindis used in seays. Inlistmode, it can display the current key bindings, list all the readline edit-ing directinv oke a giv eroutput the current set of kbindings in a format that can be incorporated directly into an inputrc Œle.Inbatchmode, it reads a series ofindings directly from a Œle and passes them to readline.In its most common usage,bindtakes a sin-gle string and passes it directly to readline, which interprets the line as if it had just been read from theinputrc Œle.Both key bindings and variable assignments may appear in the string gio.The readline library also provides an interface forworcompletioncharacter(usually TAB) is typed, readline looks at the word currently being entered and computes the set of Œle-names of which the current word is a valid preŒx.If there is only one possible completion, the rest of thecharacters are inserted directlyrd. Asecond TAB character entered immediately after a non-unique completion causes readline to listthe possible completions; there is an option to have the list displayed immediatelyvideshooks so that applications can provide speciŒc types of completion before the default Œlename completionis attempted.This is quite exible, though it is not completely user-programmable. Bash,for example, cancomplete Œlenames, command names (including aliases, builtins, shell reserved words, shell functions, andcutables found in the Œle system), shell variables, usernames, and hostnames.It uses a set of heuristicsthat, while not perfect, is generally quite good at determining what type of completion to attempt.4.4. HistoryAccess to the list of commands previously entered (thecommand historyspvided jointly by Bashand the readline libraryash provides variables ($HISTFILE,$HISTSIZE$HISTCONTROLthehistoryandfciltins to manipulate the history list.The value of$HISTFILEspecifes the Œle whereBash writes the command history on exit and reads it on startup.$HISTSIZEis used to limit the numberof commands sant.$HISTCONTROLprovides a crude form of control omands are santalue ofignorespacemeans to not save commands which begin with aspace; a value ofignoredupsmeans to not save commands identical to the last command sa$HIST-CONTROL$history_controlin earlier versions of Bash; the old name is still accepted forbackwards compatibilityhistorycommand can read or write Œles containing the history list and dis-play the current list contents.Thefcorn Shell, allows display andre-ecution, with optional editing, of commands from the history list.The readline library offers a set ofcommands to search the history list for a portion of the current input line or a string typed by the user.Finallyhistorylibraryenerally incorporated directly into the readline libraryacility forhistory recall, expansion, and re-evious commands very similar to csh (™bang historyš, socalled because the exclamation point introduces a history substitution): -6-!fghiecho a b c d eecho a b c dThe command history is only sahen the shell is interactioitisnscripts.4.5. NewShell VariablesThere are a number of connience variables that Bash interprets to makFIGNOREhich is a set of Œlename sufŒxes identifying Œles to exclude when completing Œlenames;HOSTTYPEhich is automatically set to a string describing the type of hardware on which Bash is cur-rently ecommand_oriented_historyve all lines of a multiple-line com-mand such as awhileorforloop in a single history entrywing easy re-editing; andIGNOREEOF,whose value indicates the number of consecutive EOF characters that an interactive shell will read beforeiting ­ an easy way to keep yourself from being logged out accidentallyauto_resumealters the way the shell treats simple command names: if job control is actiariable is set, sin-gle-word simple commands without redirections cause the shell to Œrst look for and restart a suspended jobwith that name before starting a ne4.6. BraceExpansionSince sh offers no conay to generate arbitrary strings that share a common preŒx or sufŒx(Œlename expansion requires that the Œlenames exist), Bash implementsbrace expansionpicked up from csh.Brace expansion is similar to Œlename expansion, but the strings generated need notcorrespond to existing Œles.xpression consists of an optionalpreamblewed by a pair ofbraces enclosing a series of comma-separated strings, and an optionalpostambleprepended to each string within the braces, and the postamble is then appended to each resulting string:ade ace abeAs this example demonstrates, the results of brace expansion are not sorted, as thexpan-sion.4.7. Process SubstitutionOn systems that can support it, Bash provides a facility known asprocess substitutionstitution is similar to command substitution in that its speciŒcation includes a command to ecute, but theshell does not collect the command'Ratherash opens a pipeto the command, which is run in the background.The shell uses named pipes (FIFOs) or the/dev/fdmethod of naming open Œles to expand the process substitution to a Œlename which connects to the pipewhen opened.This Œlename becomes the result of the expansion. Processsubstitution can be used to com-pare the outputs of twferent versions of an application as part of a regression test: -7-4.8. Prompt CustomizationOne of the more popular interactive features that Bash provides is the ability to customize theprompt. Both$PS1and$PS2,the primary and secondary prompts, are expanded before being displayed.rameter and variable expansion is performed when the prompt string is expanded, so anariablecan be put into the prompt (e.g.,$SHLVLhich indicates hoBashspecially interprets characters in the prompt string preceded by a backslash.Some of these backslashescapes are replaced with the current time, the date, the current working directoryhe username, and thecommand number or history number of the command being entered.There is ecause the shell to change its prompt when running as root after ansuBash expands the variable$PROMPT_COMMANDand, if it has a value, expanded value asommand, allowing additional prompt customization.userhe current host, the time, the last component of the current working directoryhe lefsing, and the history number of the current command to be embedded into the primary prompt:chet@odin [21:03:44] documentation(2:636)$ cd ..The string being assigned is surrounded by single quotes so that if it is exported, the value of$SHLVLwillbe updated by a child shell:chet@odin [21:17:35] src(2:638)$ export PS1The \$ escape is displayed as ™$#4.9. FileSystem ViewsSince Berkeleying properties has beenthe ™warpingš to a completely different area of the Œle system when usingcdnd the resultant non-intu-itive bvior of ™cd ..š. TheUNIXrnel treats symbolic linksphysicallyernel is translatingathname in which one component is a symbolic link, it replaces all or part of the pathname while pro-cessing the link.If the contents of the symbolic link begin with a slash, the kernel replaces the pathnameentirely; if not, the link contents replace the current component.In either case, the symbolic link is visible.If the link value is an absolute pathname, the user Œnds himself in a completely different part of the Œle sys-tem.Bash provides alogicalviefthe Œle system.In this default mode, command and Œlename com-pletion and builtin commands such ascdandpushdwhich change the current working directory transpar-ently folloThe$PWDriable, which holds the shell'the current working directoryepends on the path used to reach the directory rather than its physical loca-tion in the local Œle system hierarchy. For example:d//usr/local/bin/usr/local/bin/net/share/sun4/local/bind..$p/usr/local/net/share/sun4/locald.. -8-/usr/usrOne problem with this, of course, arises when programs that do not understand the shell'the Œle system interpret ™..ferentlyhis generally happens when Bash completes Œlenames containing™..ccording to a logical hierarchysical location.Œnd this troublesome, a correspondingphysicalvieftd//usr/local/bin/net/share/sun4/local/bin4.10. InternationalizationOne of the most signiŒcant improersion 1.13 of Bash was the change to ™eight-bit clean-linessš. Previous versions used the eighth bit of characters to mark whether or not theperforming word expansions. Whilethis did not affect the majority of users, most of whom used onlysen-bit ASCII characters, some found it conŒning.Beginning with version 1.13, Bash implemented adifferent quoting mechanism that did not alter the eighth bit of characters.This allowed Bash to manipulateŒles with ™oddš characters in their names, but did nothing to help users enter those names, so version 1.13introduced changes to readline that made it eight-bit clean as well.Options exist that force readline toattach no special signiŒcance to characters with the eighth bit set (the default behavior is to concharacters to meta-preŒxed key sequences) and to output these characters without conŒxed sequences.These changes, along with the expansion of krk with most of the ISO-8859 family of character sets, used by man4.11. POSIXModeAlthough Bash is intended to be POSIX.2 conformant, there are areas in which the default behavioris not compatible with the standard.sers who wish to operate in a strict POSIX.2 environment, Bashimplements aPOSIX modeault operation where it differsfrom POSIX.2 to match the standard.POSIX mode is entered when Bash is started with the-posixoption.This feature is also asetset -o posixsoftware that attempts to be POSIX.2 compliant, Bash also enters POSIX mode if the variable$POSIXLY_CORRECTis set when Bash is started or assigned a value during e$POSIX_PEDANTICis accepted as well, to be compatible with some older GNU utilities.When Bash isstarted in POSIX mode, for example, it sources the Œle named by the value of$ENVrather than the ™nor-malš startup Œles, and does not alloed words to be aliased.5. Newes and FuturThere are seersion of Bash, version 1.14, and a numberunder consideration for future releases.This section will briey detail the neersion 1.14 anddescribe seersions.5.1. Newes in Bash-1.14The neral of the most common requests for enhance-ments. Mostnotablyhere is a mechanism for including non-visible character sequences in prompts, suchas those which cause a terminal to print characters in different colors or in standout mode.There was noth-ing preersions, but the readline redisplay algorithm assumedeach character occupied physical screen space and would wrap lines prematurely. -9-Readline has a feew variables, sedefault key bindings. Aneistory search mode has been implemented: in this mode, readline searchesthe history for lines beginning with the characters between the beginning of the current line and the cursor.The existing readline incremental search commands no longer match identical lines more than once.File-name completion noariables in directory names.The history expansion facilities are nownearly completely csh-compatible: missing modiŒers have been added and history substitution has beenSeral of the features described earlieruch asset -o posixand$POSIX_PEDANTICnrsion 1.14.There is a neariable,OSTYPEowalue that identiŒes the ver-sion ofUNIXit'unning on (great for putting architecture-speciŒc binary directories into the$PHTw oriables have been renamed:$HISTCONTROLreplaces$history_control$HOSTFILEreplaces$hostname_completion_Œleoth cases, the old names are accepted for backwards compatibil-ityhe kshselectconstruct, which allows the generation of simple menus, has been implemented.Newcapabilities have been added to existing variables:$auto_resumecan noorsub-string$HISTCONTROLunderstands the valueignorebothhich combines the twviouslyacceptable values. Thedirsiltin has acquired options to print out speciŒc members of the directorystack. The$nolinksriable, which forces a physical viefthe Œle system, has been superseded by the­Poption to thesetset -o physical); the variable is retained for backwards compati-bilityhe version string contained in$BASH_VERSIONnoswell as the ™build versionš. Somelittle-used features have been remod: thebyesynonym forexitandthe$NO_PROMPT_VARSriable are gone.There is nonorg anized test suite that can be run as aregression test when building a neThe documentation has been thoroughly oanual page on the readlinelibrary and theinfoŒle has been updated to reect the current version. Asalys, as manble have been Œxed, although some surely remain.5.2. OtheresThere are a feSome are based on workalready done in other shells.In addition to simple variables, a future release of Bash will include one-dimensional arrays, usingthe ksh implementation of arrays as a model.Additions to the ksh syntax, such asvarname=( ... ) to assignist of words directly to an array and a mechanism to alloalues directlyinto an arrayGixtensions, the kshset ­Asyntax may not be worth support-ing (the­Aoption assigns a list of values to an arraySome shells include a means ofpr-command basis hoguments of the command are to be treated when completion is attempted: as Œle-names, hostnames, eThe other aspects of the current Bash implementation couldremain as-is; the existing heuristics would still be valid. Onlywhen completing the arguments to a simplecommand would the programmable completion be in effect.It would also be nice to give the user Œner-grained control ohich commands are sahistory list.One proposal is for a variable, tentatiHISTIGNOREhich would contain acolon-separated list of commands.Lines beginning with these commands, after the restrictions of$HIST-CONTROLhave been applied, would not be placed onto the history list.The shell pattern-matching capa-bilities could also be a$HISTIGNORE.One thing that newer shells such aswksh(also known asdtkshvide is a command to dynami-cally load code implementing additional builtin commands into a running shell.This neouldtaknobject Œle or shared library implementing the ™bodyš of the builtin (xxx_builtin()for those familiarwith Bash internals) and a structure containing the name of the neommand, the function to call when theneuiltin is inpresumably deŒned in the shared object speciŒed as an argument), and the docu-mentation to be printed by thehelpcommand (possibly present in the shared object as well).It wouldmanage the details of extending the internal table of builtins. -10-ew other builtins would also be desirable: twgetconfcommand, which printsthe values of system conŒguration variables deŒned by POSIX.2, and adisownshell running with job control active tget aboutš one or more background jobs in its internal jobstable. Usinggetconfor example, a user could retrieve a value for$PHPOSIX standard utilities, or Œnd out hoong Œlenames may be in the Œle system containing a speciŒeddirectory.There are no implementation timetables for anfthese features, nor are there concrete plans toinclude them.If anyone has comments on these proposals, feel free to send me electronic mail.6. Reectionsand Lessons LearnedThe lesson that has been repeated most often during Bash dein the Bourne shell, and people use all of them.In the original description of the Bourne shell, quoting andthe shell grammar are both poorly speciŒed and incomplete; subsequent descriptions have not helped much.The grammar presented in Bourne'uted with the SeUNIXssofar ofwho|wcom DufNobody really knows what the Bourne shell'Even examination of the sourcecode is little help.ˆThe POSIX.2 standard includes ayaccgrammar that comes close to capturing the Bourne shell'vior,tdws some constructs which sh accepts without complaint ­ and there are scripts out there thatuse them.It took a feug reports before Bash implemented sh-compatible quoting,and there are still some ™leComplete sh compatibilityis a tough nut.The shell is bigger and slower than I would like, though the current version is substantially fasterthan previouslyhe readline library could stand a substantial rewrite. Ahand-written parser to replace thecurrentyacc-generated one would probably result in a speedup, and would solvtheshell could parse commands in ™$(...)š constructs as there entered, rather than reporting errors when theconstruct is expanded.As alogowAreas of duplicated functionality need to becleaned up.There are seariable specially to enable functionality aanother way ($notifyvs.set -o notifyand$nolinksvs.set -o physicalof the variable name should probably be remod. Afeore things could stand remo$allow_null_glob_expansionand$glob_dot_Œlenamesriables are of particularly questionable value.The$[...]arithmetic eluation syntax is redundant no$((...))construct hasbeen implemented, and could be deleted.It would be nice if the text output by thehelpiltin were exter-nal to the shell rather than compiled into it.The behavior enabled by$command_oriented_historycauses the shell to attempt to save all lines of a multi-line command in a single history entrymade the default and the variable remo7. AAs with all other GNU software, Bash is aymous FTP fromprep.ai.mit.edu:/pub/gnuand from other GNU software mirror sites.The current version is inbash-1.14.1.tar.gzin that directory.Usearto Œnd the nearest archive site. Thelatest version is albash.CWRBash documentation is abash.CWRThe Free Software Foundation sells tapes and CD-ROMs containing Bash; send electronic mail tognu@prep.ai.mit.eduor call+1-617-876-3296for more information.Bash is also distributed with seersions ofUNIX-compatible systems.It is included as /bin/shand /bin/bash on seutions (more about the difference in a moment), and as contributed‡S. R. Bourne, ™UNIX Time-Sharing System:The UNIX Shellš,Bell System Technical JournalAugust, 1978, pp. 1971-1990.om Duff, ™Rc ­ A Shell for Plan 9 andUNIXsystemsš,Proc. of the Summer 1990 EUUG Conferencedon, July -11-software in BSDI'The Linux distribution deserves special mention.There are twonŒgurations included in the stan-dard Bash distribution: a ™normalš conŒguration, in which all of the standard features are included, and a™minimalš conŒguration, which omits job control, aliases, history and command line editing, the directorystack andpushd/popd/dirs,process substitution, prompt string special character decoding, and theselectconstruct. Thisminimal version is designed to be a drop-in replacement for the traditionalUNIX/bin/sh,and is included as the Linux /bin/sh in se8. ConclusionBash is a worthIt is sufŒciently portable to run on nearly eersion ofUNIXfrom 4.3 BSD to SVR4.2, and seUNIXes. Itis robust enough to replace sh on most of thosesystems, and provides more functionalitygular users, and their feedback hashelped to maktasgare.*BSD/386 is a trademark of Berkeleare Design, Inc.