.\" .\" MAN PAGE COMMENTS to .\" .\" Chet Ramey .\" Information Network Services .\" Case Western Reserve University .\" chet@ins.CWRU.Edu .\" .\" Last Change: Wed Jan 20 16:47:14 EST 1999 .\" .\" bash builtins, strip all but Built-Ins section .if \n(zZ=1 .ig zZ .if \n(zY=1 .ig zY .TH BASH 1 "1999 Jan 20" GNU .\" .\" There's some problem with having a `@' .\" in a tagged paragraph with the BSD man macros. .\" It has to do with `@' appearing in the }1 macro. .\" This is a problem on 4.3 BSD and Ultrix, but Sun .\" appears to have fixed it. .\" If you're seeing the characters .\" `@u-3p' appearing before the lines reading .\" `possible-hostname-completions .\" and `complete-hostname' down in READLINE, .\" then uncomment this redefinition. .\" .de }1 .ds ]X \&\\*(]B\\ .nr )E 0 .if !"\\$1"" .nr )I \\$1n .}f .ll \\n(LLu .in \\n()Ru+\\n(INu+\\n()Iu .ti \\n(INu .ie !\\n()Iu+\\n()Ru-\w\\*(]Xu-3p \{\\*(]X .br\} .el \\*(]X\h|\\n()Iu+\\n()Ru\c .}f .. .\" .\" File Name macro. This used to be `.PN', for Path Name, .\" but Sun doesn't seem to like that very much. .\" .de FN \fI\|\\$1\|\fP .. .SH NAAM bash \- GNU Bourne-Again SHell .SH OVERZICHT .B bash [opties] [bestand] .SH COPYRIGHT .if n Bash is Copyright (C) 1989-1999 van de Free Software Foundation, Inc. .if t Bash is Copyright \(co 1989-1999 van de Free Software Foundation, Inc. .SH BESCHRIJVING .B Bash is een met \fBsh\fR-overeenkomende opdracht taal interpreteerder die opdrachten uitvoert die gelezen worden van de standaard invoer, of van een bestand. .B Bash implementeert ook bruikbare eigenschappen van de \fIKorn\fP en \fIC\fP shell's (\fBksh\fP en \fBcsh\fP). .PP .B Bash is bedoeld om overeen te komen met de implementatie van de IEEE POSIX Shell en Tools specificatie (IEEE Werkgroep 1003\.2). .SH OPTIES In aanvulling op de enkele-karakter shell opties beschreven in de documentatie voor de ingebouwde \fBset\fR opdracht, interpreteert \fBbash\fR de volgende opties wanneer het aangeroepen wordt: .PP .PD 0 .TP 10 .BI \-c "\| string\^" Als de .B \-c optie aanwezig is, dan worden opdrachten gelezen van .IR string . Als er argumenten na de .IR string zijn, dan worden ze toegeschreven aan de plaatsbepaalde grootheden, startend met .BR $0 . .TP .B \-r Als de .B \-r optie aanwezig is, dan wordt gebruik van de shell .I beperkt. (zie .SM .B "BEPERKTE SHELL" onder). .TP .B \-i Als de .B \-i optie aanwezig is dan wordt de shell .IR interactief . .TP .B \-s Als de .B \-s optie aanwezig is, of als geen argumenten overblijven na optie verwerking, dan worden opdrachten van standaard invoer gelezen. Deze optie laat toe dat de plaatsbepaalde grootheden gezet worden bij het aanroepen van een interactieve shell. .TP .B \-v Druk shell invoer regels af als ze gelezen worden. .TP .B \-x Druk opdrachten en hun argumenten af als ze uitgevoerd worden. .TP .B \-D Een lijst van alle, met dubbeleaanhalingstekens geciteerde, strings voorafgegaan door \fB$\fP wordt afgedrukt op de standaard uitvoer. Dit zijn de strings die voorwerp tot taal vertaling zijn wanneer de huidige localiteit niet C of POSIX is. Dit impliceert de \fB\-n\fP optie; geen opdrachten zullen uitgevoerd worden. .TP .B \-\- Een .B \-\- kondigt het einde van opties aan en schakelt verdere optieverwerking uit. Mogelijke argumenten na de .B \-\- worden als bestandsnamen en argumenten behandeld. Een argument .B \- is gelijk aan \fB\-\-\fP. .PD .PP .B Bash begrijpt ook een aantal meerkarakter opties. Deze opties moeten op de opdrachtregel verschijnen vóór de enkele-karakter opties, om herkenbaar te zijn. .PP .PD 0 .TP .B \-\-dump\-po\-strings {#\-\-dump\-overdraagbare\-object\-strings#} Gelijk aan \fB\-D\fP, maar de uitvoer is in de GNU \fIgettext\fP \fBpo\fP (overdraagbaar object) bestand vorm. .TP .B \-\-dump\-strings {#\-\-dump\-strings#} Gelijk aan \fB\-D\fP. .TP .B \-\-help {#\-\-hulp#} Geef een gebruik bericht op de standaard uitvoer en eindig geslaagd. .TP .B \-\-login {#\-\-meldt\-aan#} Laat .B bash zich gedragen alsof het aangeroepen werd als een inlog shell (zie .SM .B AANROEPEN onder). .TP .B \-\-noediting {#\-\-niet\-bewerken,nl#} Gebruik de GNU .B readline {#lees regel#} bibliotheek niet om opdracht regels te lezen als interactief. .TP .B \-\-noprofile {#\-\-geen\-profiel#} Lees niet het globale systeem opstart bestand .FN /etc/profile of één van de persoonlijke initialisatiebestanden .IR ~/.bash_profile , .IR ~/.bash_login , of .IR ~/.profile . Standaard leest .B bash deze bestanden wanneer het aangeroepen wordt als een inlog shell (zie .SM .B AANROEPEN onder). .TP .B \-\-norc {#\-\-niet\-d(raai)\-o(pdrachten)#} .\" rc == runcom, run commands? Ga niet het persoonlijke initialisatiebestand .I ~/.bashrc lezen en uitvoeren als de shell interactief is. Deze optie is normaal aan als de shell aangeroepen wordt als .BR sh . .TP .B \-\-posix {#\-\-"posix"#} Veranderd het gedrag van \fBbash\fP waar het normale gedrag verschilt van de POSIX 1003.2 standaard om overeen te komen met de standaard. .TP \fB\-\-rcfile\fP \fIbestand\fP {#\-\-d(raai)\-o(opdrachten)\-bestand#} Voer opdrachten van .I bestand uit in plaats van het normale persoonlijke initialisatiebestand .I ~/.bashrc als de shell interactief is (zie .SM .B AANROEPEN onder). .TP .B \-\-restricted {#\-\-beperkt#} De shell wordt beperkt (zie .SM .B "BEPERKTE SCHELP" onder). .TP .B \-\-verbose {#\-\-praatgraag#} Gelijk aan \fB\-v\fP. .TP .B \-\-version {#\-\-versie#} Geef versie informatie voor deze .B bash op de standaard uitvoer en eindig geslaagd. .PD .SH ARGUMENTEN Als argumenten overblijven na optie verwerking, en niet de .B \-c nog de .B \-s optie werd gegeven, dan wordt aangenomen dat het eerste argument de naam van een bestand met shell opdrachten is. Als .B bash is aangeroepen op deze manier, dan wordt .B $0 gezet naar de naam van het bestand, en de plaatsbepaalde grootheden worden gezet naar de overblijvende argumenten. .B Bash leest en voert de opdrachten in dit bestand uit, en eindigt dan. \fBBash\fP's einde status is de einde status van de laatste opdracht uitgevoerd in het script. Als geen opdrachten werden uitgevoerd is de einde status 0. .SH AANROEPEN Een \fIinlog shell\fP in er een wiens eerste karakter van argument nul een .BR \- " is," of een gestart met de .B \-\-login {#\-\-inlog#} optie. .PP Een \fIinteractieve\fP shell is er één waarvan de standaard invoer en uitvoer allebei met een terminal zijn verbonden (zoals bepaald door .IR isatty (3)), of één gestart met de .B \-i optie. .SM .B PS1 wordt gezet en .B $\- bevat .B i als .B bash interactief is; dit staat een shellscript of een opstartbestand toe deze status te testen. .PP De volgende alinea's beschrijven hoe .B bash zijn opstart bestanden uitvoert. Als een van de bestanden bestaat maar niet gelezen kan worden dan rapporteert .B bash een fout. Tildes worden geëxpandeerd tot bestand namen zoals beschreven onder bij .B "Tilde Expandering" in het .SM .B VERGROTING gedeelte. .PP Wanneer .B bash is aangeroepen als een interactieve inlog shell, of als een niet-interactieve shell met de \fB\-\-login\fP {#\-\-inlog#} optie, dan leest en voert eerst de opdrachten van het bestand \fI/etc/profile\fP uit, als dat bestand bestaat. Na het lezen van dat bestand zoekt het naar \fI~/.bash_profile\fP, \fI~/.bash_login\fP, en \fI~/.profile\fP, in die volgorde, en leest en voert de opdrachten uit van de eerste die bestaat en leesbaar is. De .B \-\-noprofile {#\-\-geen\-profiel#} optie kan gebruikt worden wanneer de shell wordt gestart om dit gedrag te stuiten. .PP Wanneer een inlog shell eindigt, leest .B bash de opdrachten van het bestand \fI~/.bash_logout\fP en voert ze uit, als het bestaat. .PP Wanneer een interactieve shell die niet een inlog shell is, start, leest .B bash de opdrachten van \fI~/.bashrc\fP en voert ze uit, als dat bestand bestaat. Dit kan gestuit worden door de .B \-\-norc {#\-\-geen\-"rc"#} optie te gebruiken. De \fB\-\-rcfile\fP \fIbestand\fP {#\-\-"rc"bestand#} optie zal .B bash dwingen om de opdrachten van \fIbestand\fP te lezen en uit te voeren in plaats van \fI~/.bashrc\fP. .PP Wanneer .B bash niet-interactief is gestart, om een shell script te draaien bijvoorbeeld, zoekt het naar de variabele .SM .B BASH_ENV in de omgeving, legt zijn waarde uit als het er lijkt te zijn, en gebruikt de geïnterpreteerde waarde als de naam van een bestand om te lezen en uit te voeren. .B Bash gedraagt zich alsof de volgende opdracht was uitgevoerd: .sp .5 .RS \f(CWif [ \-n "$BASH_ENV" ]; then . "$BASH_ENV"; fi\fP .RE .sp .5 maar de waarde van de .SM .B PATH {#weg#} variabele wordt niet gebruikt om de bestand naam te zoeken. .PP Als .B bash werd aangeroepen met de naam .BR sh , probeert het het opstart gedrag van historische versies van .B sh zo goed mogelijk na te doen, onderwijl ook nog voldoend aan de POSIX standaard. Wanneer aangeroepen als een interactieve inlog shell, of een niet-interactieve shell met de \fB\-\-login\fP optie, dan probeert het eerst om opdrachten van .I /etc/profile en .IR ~/.profile , in die volgorde, te lezen en uit te voeren. De .B \-\-noprofile {#\-\-geen\-profiel#} optie kan gebruikt worden om dit gedrag te stuiten. Wanneer aangeroepen als een interactieve shell met de naam .BR sh ", dan zal" .B bash naar de variabele .SM .BR ENV , zoeken, en zijn waarde interpreteren als die bepaald is, en de geïnterpreteerde waarde gebruiken als de naam van een bestand om te lezen en uit te voeren. Omdat een shell aangeroepen als .B sh niet probeert om opdrachten van enig ander opstart bestand te lezen en uit te voeren, heeft de .B \-\-rcfile optie geen gevolgen. Een niet-interactieve shell aangeroepen met de naam .B sh probeert niet om enige andere opstart bestanden te lezen. Wanneer aangeroepen als .BR sh ", dan zal" .B bash .I posix mode ingaan nadat de opstart bestanden gelezen zijn. .PP Wanneer .B bash gestart is in .I posix toestand, zoals met de .B \-\-posix opdracht regel optie, dan volgt het de POSIX standaard voor opstart bestanden. In deze mode leggen interactieve shell's de .SM .B ENV variabele uit en opdrachten worden gelezen en uitgevoerd van het bestand wiens naam de geïnterpreteerde waarde is. Geen andere opstart bestanden worden gelezen. .PP .B Bash probeert te bepalen of het gedraaid wordt door de op-afstand shell demoon, gewoonlijk \fIrshd\fP. Als .B bash bepaalt dat het gedraaid wordt door \fIrshd\fP leest en voert het opdrachten uit van \fI~/.bashrc\fP als dat bestand bestaat en leesbaar is. Het zal dit niet doen als het aangeroepen werd als \fBsh\fP. De .B \-\-norc {#\-\-geen"rc"#} optie kan gebruikt worden om dit gedrag te stuiten en de .B \-\-rcfile {#\-\-"rc"bestand#} optie mag gebruikt worden om een ander bestand af te dwingen, maar \fIrshd\fP roept in het algemeen de shell niet aan met deze opties of laat toe om ze op te geven. .PP Als de shell gestart is met het geldende gebruiker (groep) id ongelijk aan het echte gebruiker (groep) id, en de \fB\-p\fP optie is niet geleverd, dan worden geen opstart bestanden gelezen, shell functies worden niet van de omgeving geërfd, de \fBSHELLOPTS\fP variabele, als het in de omgeving voorkomt, wordt genegeerd, en het geldende gebruiker id wordt gezet naar het echte gebruiker id. Als de \fB\p\fP optie is geleverd bij aanroepen is het opstart gedrag hetzelfde, maar het geldende gebruiker id is niet her-zet. .SH BEPALINGEN .PP De volgende begripsbepalingen worden gebruikt in de rest van dit document. .PD 0 .TP .B ruimte Een spatie of tabulatie. .TP .B woord Een opeenvolging van karakters die als één geheel worden beschouwd door de shell. Ook bekend onder de naam .BR voorwerp {#"token"#}. .TP .B naam Een .I woord bestaande uit alleen alphanumerieke karakters en onder_streepje {#_#}, en beginnend met een alphabetisch karakter of een onder_streepje. Ook naar verwezen als .BR identificeerder. .TP .B metakarakter Een karakter dat, wanneer ongeciteerd, woorden scheidt. Een van de volgende: .br .RS .PP .if t \fB| & ; ( ) < > spatie tabulatie\fP .if n \fB| & ; ( ) < > spatie tabulatie\fP .RE .PP .TP .B controle operator Een \fIvoorwerp\fP dat een controle functie uitvoert. Het is een van de volgende symbolen: .RS .PP .if t \fB\(bv\(bv & && ; ;; ( ) | \fP .if n \fB|| & && ; ;; ( ) | \fP .RE .PD .SH "GERESERVEERDE WOORDEN" \fIGereserveerde woorden\fP zijn woorden die een bijzondere betekenis voor de shell hebben. De volgende woorden worden herkent als gereserveerd wanneer ongeciteerd en als het het eerste woord van een simpele opdracht (zie .SM .B SCHELP SPELLING onder), of het derde woord van een .B case of .B for opdracht is: .if t .RS .PP .B .if n ! case do done elif else esac fi for function if in select then until while { } time [[ ]] .if t ! case do done elif else esac fi for function if in select then until while { } time [[ ]] .if t .RE .RE .SH "SCHELP SPELLING" .SS Simpele Opdrachten .PP Een \fIsimpele opdracht\fP is een opeenvolging van eventuele variabele toekenningen gevolgd door met \fBruimte\fP-gescheiden woorden en omleidingen, en beëindigd door een \fIcontrole operator\fP. Het eerste woord geeft de uit te voeren opdracht op. De overblijvende woorden worden als argumenten doorgegeven aan de aangeroepen opdracht. .PP De teruggeef waarde van een \fIsimpele opdracht\fP is zijn einde staat, of 128+\fIn\^\fP als de opdracht werd beëindigt door een signaal. .IR n . .SS Pijplijnen .PP Een \fIpijplijn\fP is een opeenvolging van één of meerdere opdrachten gescheiden door het karakter .BR | . De vorm voor een pijplijn is: .RS .PP [\fBtime\fP [\fB\-p\fP]] [ ! ] \fIopdracht\fP [ \fB|\fP \fIopdracht2\fP ... ] .RE .PP De standaard uitvoer van .I opdracht is verbonden met de standaard invoer van .IR opdracht2 . Deze koppeling wordt uitgevoerd vóór enige omleidingen opgegeven door de opdracht (zie .SM .B OMLEIDEN onder). .PP Als het gereserveerde woord .B ! voorafgaat aan de pijplijn dan is de einde status van die pijplijn de logische NIET van de einde status van de laatste opdracht. Anders is de status van de pijplijn de einde status van de laatste opdracht. De shell wacht tot alle opdrachten in de pijplijn zijn beëindigd vóór het teruggeven van een waarde. .PP Als het gereserveerde woord .B time {#tijd#} aan de pijplijn voorafgaat, dan worden zowel de verstreken-, de gebruiker- en de systeemtijd verorberd door zijn uitvoering gerapporteerd wanneer de pijplijn eindigt. De \fB\-p\fP optie veranderd de uitvoer vorm naar dat opgegeven door POSIX. De .SM .B TIMEFORMAT {#tijd vorm#} variabele mag worden gezet naar een vorm-string dat opgeeft hoe de tijd informatie weergegeven zouden moeten worden; zie de beschrijving van .SM .B TIMEFORMAT onder .B "Shell Variabelen" onder. .PP Elke opdracht in een pijplijn wordt uitgevoerd als een apart proces (dat is, in een sub-shell). .SS Lijsten .PP Een \fIlijst\fP is een opeenvolging van één of meer pijplijnen gescheiden door één van de operators .BR ; , .BR & , .BR && , of .BR \(bv\(bv , en eventueel beëindigd door één van .BR ; , .BR & , of .BR . .PP Van deze lijst operatoren hebben .B && en .B \(bv\(bv gelijke voorrang, gevolgd door .B ; en .BR &, die dezelfde voorrang hebben. .PP Als een opdracht beëindigd wordt door de controle operator .BR & , dan voert de shell de opdracht uit in de \fIachtergrond\fP in een sub-shell. De shell wacht niet tot de opdracht eindigt, en de teruggeef status is 0. Opdrachten gescheiden door een .B ; worden opeenvolgend uitgevoerd; de shell wacht om de beurt op elke opdracht . De teruggeef status is de einde status van de laatst uitgevoerde opdracht. .PP De controle operators .B && en .B \(bv\(bv beschrijven respectievelijk EN lijsten en OF lijsten. Een EN lijst heeft de vorm .RS .PP \fIopdracht\fP \fB&&\fP \fIopdracht2\fP .RE .PP .I opdracht2 wordt uitgevoerd als, en alleen als .I opdracht een einde status teruggeeft van nul. .PP Een OF lijst heeft de vorm .RS .PP \fIopdracht\fP \fB\(bv\(bv\fP \fIopdracht2\fP .PP .RE .PP .I opdracht2 wordt uitgevoerd als en alleen als .I opdracht een niet-nul einde status teruggeeft. De teruggeef status van EN en OF lijsten is de einde status van de laatst uitgevoerde opdracht in de lijst. .SS Gecompileerde Opdrachten .PP Een \fIgecompileerde opdracht\fP is een van de volgende: .TP (\fIlijst\fP) \fIlijst\fP wordt uitgevoerd in een sub-shell. Variabele toekenningen en ingebouwde opdrachten die de shell's omgeving beïnvloeden blijven geen gelding houden nadat de opdracht afgerond is. De teruggeef status is de einde status van \fIlijst\fP. .TP { \fIlijst\fP; } \fIlijst\fP wordt eenvoudig uitgevoerd in de huidige shell omgeving. \fIlijst\fP moet afgesloten worden met een nieuwe regel of dubbelepunt. Dit status bekend als een \fIgroep opdracht\fP. De teruggeef status is de einde status van \fIlijst\fP. .TP ((\fIexpressie\fP)) De \fIexpressie\fP wordt beoordeeld volgens de regels beschreven onder .SM .BR "REKENKUNDIGE BEOORDELING" Als de waarde van de expressie niet-nul is, dan is de teruggeef status 0; anders is de teruggeef status 1. Dit is precies gelijk aan \fBlet "\fIexpressie\fP"\fR. .TP \fB[[\fP \fIexpressie\fP \fB]]\fP Geeft een status terug van 0 of 1 afhankelijk van de beoordeling van de voorwaardelijke expressie \fIexpressie\fP. Expressies worden gecompileerd uit de onderdelen beschreven onder .SM .BR "VOORWAARDELIJKE UITDRUKKINGEN" Woord splitsen en padnaam expandering worden niet uitgevoerd op de woorden tussen de \fB[[\fP en \fB]]\fP; tilde expandering, grootheid en variabele expandering, rekenkundige expandering, opdracht substitutie, proces substitutie, en citeer verwijdering worden wel uitgevoerd. .if t .sp 0.5 .if n .sp 1 Wanneer de \fB==\fP en \fB!=\fP operators worden gebruikt wordt het string rechts van de operator als een patroon genomen en gepast volgens de regels beschreven onder \fBPatroon Passen\fP. De teruggave waarde is 0 als het string past en anders 1 als het niet past met het patroon. Elk gedeelte van het patroon mag geciteerd worden om af te dwingen dat het als een string wordt gepast. .if t .sp 0.5 .if n .sp 1 Expressies mogen gecompileerd worden met gebruik van de volgende expressies, opgegeven in aflopende volgorde van voorrang: .if t .sp 0.5 .if n .sp 1 .RS .PD 0 .TP .B ( \fIexpressie\fP ) Geeft de waarde van \fIexpressie\fP. Dit mag gebruikt worden om de normale voorrang van operators opzij te zetten. .TP .B ! \fIexpressie\fP Waar als .I expressie fout is. .TP \fIexpressie\fP \fB&&\fP \fIexpressie\fP Waar als beide .I expressie1 en .I expressie2 waar zijn. .TP .if t \fIexpressie1\fP \fB\(bv\(bv\fP \fIexpressie2\fP .if n \fIexpressie1\fP \fB||\fP \fIexpressie2\fP Waar als .I expressie1 of .I expressie2 waar is. .PD .RE .LP De \fB&&\fP en .if t \fB\(bv\(bv\fP .if n \fB||\fP operators voeren \fIexpressie2\fP niet uit als de waarde van \fIexpressie\fP voldoende is om de teruggeef waarde van de hele voorwaardelijke expressie te bepalen. .TP \fBfor\fP \fInaam\fP [ \fBin\fP \fIwoord\fP ] ; \fBdo\fP \fIlijst\fP ; \fBdone\fP De lijst van woorden die \fBin\fP volgt wordt geëxpandeerd, een lijst van zaken producerend. De variabele \fInaam\fP wordt om de beurt gezet naar elk element van deze lijst, en \fIlijst\fP wordt elke keer uitgevoerd. Als de \fBin\fP \fIwoord\fP weggelaten wordt, dan voert de \fPfor\fP {#voor#} opdracht \fIlijst\fP één keer uit voor elke plaatsbepaalde grootheid die gezet is (zie .SM .B GROOTHEDEN onder). De teruggeef status is de einde status van de laatste opdracht die uitvoert. Als de expandering van de zaken volgend op \fBin\fP een lege lijst oplevert worden geen opdrachten uitgevoerd, en de teruggeef status is 0. .TP \fBselect\fP \fInaam\fP [ \fBin\fP \fIwoord\fP ] ; \fBdo\fP \fIlijst\fP ; \fBdone\fP De lijst van woorden volgend op \fBin\fP wordt geëxpandeerd, een lijst van zaken opleverend. De set geëxpandeerde woorden wordt afgedrukt op de standaard fout uitvoer, elk voorafgegaan door een nummer. Als de \fBin\fP \fIwoord\fP weggelaten wordt, worden de plaatsbepaalde grootheden afgedrukt (zie .SM .B GROOTHEDEN onder). De .B PS3 prompt wordt dan weergegeven en de een regel wordt gelezen van de standaard invoer. Als de regel bestaat uit een nummer overeenkomend met een van de weergegeven woorden, dan wordt de waarde van .I naam gezet naar dat woord. Als de regel leeg is worden de woorden en de prompt opnieuw weergegeven. Als EOF {einde-van-bestand} gelezen wordt rond de opdracht af. Elke andere waarde zorgt dat .I naam naar nul wordt gezet. De gelezen regel wordt bewaard in de variabele .BR REPLY . De .I lijst wordt uitgevoerd na elke optie totdat een .B break of .B return opdracht uitgevoerd wordt. De einde status van .B select is de einde status van de laatste opdracht uitgevoerd in .IR lijst , of nul als geen opdrachten werden uitgevoerd. .TP \fBcase\fP \fIwoord\fP \fBin\fP [ ( \fIpatroon\fP [ \fB|\fP \fIpatroon\fP ] \ ... ) \fIlijst\fP ;; ] ... \fBesac\fP Een \fBcase\fP opdracht geëxpandeerd eerst \fIwoord\fP en probeert het dan om de beurt te passen op \fIpatroon\fP, gebruik makend van dezelfde pas-regels als voor padnaam expanderingen (zie .B padnaam Expandering onder). Wanneer een overeenkomst gevonden is wordt de bijbehorende \fIlijst\fP uitgevoerd. Na de eerste overeenkomst worden geen volgende overeenkomsten geprobeerd. De einde status is nul als geen patronen passen. Anders is het de einde status van de laatst uitgevoerde opdracht in \fIlijst\fP. .TP \fBif\fP \fIlijst\fP; \fBthen\fP \fIlijst;\fP \ [ \fBelif\fP \fIlijst\fP; \fBthen\fP \fIlijst\fP; ] ... \ [ \fBelse\fP \fIlijst\fP; ] \fBfi\fP De .B if .I lijst wordt uitgevoerd. Als zijn einde status nul is wordt de \fBthen\fP \fIlijst\fP uitgevoerd. Anders wordt elke \fBelif\fP lijst om de beurt uitgevoerd, en als de einde status nul is, dan wordt zijn bijbehorende \fBthen\fP \fIlijst\fP uitgevoerd en rond de opdracht af. Anders wordt de \fBelse\fP \fIlijst\fP uitgevoerd als aanwezig. De einde status is de einde status van de laatst uitgevoerde opdracht, of nul als geen enkele test waar was. .TP .PD 0 \fBwhile\fP \fIlijst\fP; \fBdo\fP \fIlijst\fP; \fBdone\fP .TP \fBuntil\fP \fIlijst\fP; \fBdo\fP \fIlijst\fP; \fBdone\fP .PD De \fBwhile\fP opdracht gaat steeds door met het uitvoeren van de \fBdo\fP \fIlijst\fP zolang als de laatste opdracht in \fIlijst\fP een einde staat van nul teruggeeft. De \fBuntil\fP opdracht is gelijk aan de \fBwhile\fP opdracht, behalve dat de test omgekeerd wordt; the .B do .I lijst wordt uitgevoerd zolang als de laatste opdracht in .I lijst een niet-nul einde status teruggeeft. De einde status van de \fBwhile\fP en \fBuntil\fP opdrachten is de einde staat van de laatst uitgevoerde \fBdo\fP \fIlijst\fP opdracht, of nul als er geen werd uitgevoerd. .TP [ \fBfunction\fP ] \fInaam\fP () { \fIlijst\fP; } Dit bepaalt een functie genaamd \fInaam\fP. Het \fIlichaam\fP van de functie is de .I lijst van opdrachten tussen { en }. Deze lijst wordt uitgevoerd telkens als \fInaam\fP wordt opgegeven als de naam van een simpele opdracht. De einde staat van een functie is de einde status van de laatst uitgevoerde opdracht in het lichaam. (Zie .SM .B FUNCTIES onder.) .SH OPMERKINGEN In een niet-interactieve shell, of een interactieve shell waarin de .B interactive_comments {#interactieve opmerkingen#} optie van het ingebouwde .B shopt aan status (zie .SM .B "SCHELP INGEBOUWDE OPDRACHTEN" onder), veroorzaakt een woord dat begint met .B # dat dat woord en alle overblijvende woorden op die regel genegeerd worden. Een interactieve shell zonder dat de .B interactive_comments aan staat, status geen opmerkingen toe. De .B interactive_comments optie is normaal aan in interactieve shell's. .SH CITEREN \fICiteren\fP wordt gebruikt om de bijzondere betekenis van bepaalde karakters of woorden voor de shell te verwijderen. Citeren kan gebruikt worden om speciale behandeling van bijzondere karakters uit te zetten, om te voorkomen dat gereserveerde woorden herkent worden door de shell als zodanig, en om grootheid expandering te voorkomen. .PP Elk van de \fImetakarakters\fP opgegeven boven, onder .SM .B BEPALINGEN heeft bijzondere betekenis voor de shell en moet geciteerd worden als ze zichzelf moeten voorstellen. Er zijn drie citeer manieren: de .IR "escape karakter" , enkele aanhalingstekens, en dubbele aanhalingstekens. .PP Een niet-geciteerde backslash (\fB\e\fP) is het .IR "escape karakter" . Het behoudt de letterlijke betekenis van het volgende karakter erachter, met uitzondering van . Als een \fB\e\fP paar opduikt, en de backslash is niet zelf geciteerd, de \fB\e\fP wordt behandeld als een doorgaan van de regel (dat is, het wordt verwijderd van de invoer stroom en wordt feitelijk genegeerd). .PP Omsluiten van karakters in enkele-aanhalingstekens behoudt de letterlijke waarde van elk karakter binnen de aanhalingstekens. Een enkel-aanhalingsteken mag niet voorkomen tussen enkele-aanhalingstekens, zelfs niet wanneer voorafgegaan door een backslash. .PP Omsluiten van karakters in dubbele aanhalingstekens behoudt de letterlijke waarde van alle karakters binnen de aanhalingstekens, met uitzondering van .BR $ , .BR ` , en .BR \e . De karakters .B $ en .B ` behouden hun bijzondere betekenis binnen dubbele-aanhalingstekens. De backslash behoudt zijn bijzondere betekenis alleen wanneer gevolgd door een van de volgende karakters .BR $ , .BR ` , \^\fB"\fP\^, .BR \e , of .BR . Een dubbel-aanhalingsteken mag geciteerd worden binnen dubbele aanhalingstekens door het vooraf te laten gaan door een backslash. .PP De bijzondere grootheden .B * en .B @ hebben bijzondere betekenis wanneer in dubbele aanhalingstekens (zie .SM .B GROOTHEDEN onder). .PP Woorden in do vorm \fB$\fP'\fIstring\fP' worden bijzonder behandeld. Het woord geëxpandeerd tot \fIstring\fP, met backslash-ge-escape'te karakters vervangen zoals opgegeven door de ANSI C standaard. Terugslag escape opeenvolgingen, als aanwezig, worden als volgt ontcijfert: .RS .PD 0 .TP .B \ea let-op (bel) .TP .B \eb backspace .TP .B \ee een escape karakter .TP .B \ef bladzijde doorvoer {#"form feed"#} .TP .B \en nieuwe regel .TP .B \er regel overhaal .TP .B \et horizontale tabulatie .TP .B \ev verticale tabulatie .TP .B \e\e backslash .TP .B \e\fInnn\fP het karakter wiens ASCII code de octale {#8-tallige#} waarde \fInnn\fP is (één tot drie cijfers) .TP .B \ex\fInnn\fP het karakter wiens ASCII code de hexadecimale {#16-tallige#} waarde \fInnn\fP is (één tot drie cijfers} .PD .RE .LP Het vertaalde resultaat is enkel-geciteerd, alsof het dollar-teken niet aanwezig was. .PP Een dubbel-geciteerde string voorafgegaan door een dollar teken (\fB$\fP) zal zorgen dat het string vertaald wordt volgens de huidige localiteit. Als de huidige localiteit \fBC\fP of \fBPOSIX\fP is dan wordt het dollar teken genegeerd. Als het string vertaald en vervangen wordt, dan wordt de substitutie dubbel-geciteerd. .SH GROOTHEDEN Een .I grootheid is een ding dat waardes opslaat. Het kan een .IR naam , een nummer, of één van de bijzondere karakters onder opgenoemd zijn bij .BR "Bijzondere Grootheden" . Voor de shell's doeleinden is een .I variabele een grootheid beschreven door een .IR naam . .PP Een grootheid is gezet als het een waarde toegekend is. Het nul string is een geldige waarde. Als een variabele eenmaal is gezet, kan het alleen ge-onzet worden door de .B unset ingebouwde opdracht te gebruiken (zie .SM .B SCHELP INGEBOUWDE OPDRACHTEN onder). .PP Aan een .I variabele mag mag toegekend worden door een opdracht met de vorm .RS .PP \fInaam\fP=[\fIwaarde\fP] .RE .PP Als .I waarde niet is gegeven dan wordt de variabele het nul string toegekend. Alle .I waardes ondergaan tilde expandering, grootheid en variabele expandering, string expandering, opdracht substitutie, rekenkundige expandering, en citerings verwijdering (zie .SM .B VERGROTING onder). Als de variabele zijn .B heel-getal {#integer#} eigenschap aan heeft staan (zie .B maak-bekend {#declare#} onder in .SM .BR "SCHELP INGEBOUWDE OPDRACHTEN" ) dan is .I waarde voorwerp voor rekenkundige expandering zelfs als de $((...)) expandering niet wordt gebruikt (zie .B "Rekenkundige Expandering" onder). Woord splitsen wordt niet gedaan, met uitzondering van \fB"$@"\fP zoals onder geïnterpreteerd bij .BR "Bijzondere Grootheden" padnaam expandering wordt niet gedaan. .SS Plaatsbepaalde Grootheden .PP Een .I plaatsbepaalde grootheid is een grootheid aangeduid door één of meer cijfers, anders dan het enkele cijfer 0. Plaatsbepaalde grootheden worden toegekend van de shell's argumenten wanneer het wordt aangeroepen, en mogen hertoegekend worden met de ingebouwde .B set opdracht. Aan plaatsbepaalde grootheden mag niet toegekend worden met een toekennings verklaring. De plaatsbepaalde grootheden worden tijdelijk vervangen wanneer een shell functie wordt uitgevoerd (zie .SM .B FUNCTIES onder). .PP Wanneer een plaatsbepaalde grootheid bestaande uit meer dan een enkel cijfer geëxpandeerd wordt moet het omsloten worden door haakjes (zie .SM .B VERGROTEN onder). .SS Bijzondere Grootheden .PP De shell behandeld verschillende grootheden bijzonder. Deze grootheden mogen alleen bevraagt worden; toekennen aan hen is niet toegestaan. .PD 0 .TP .B * Expandeert tot de plaatsbepaalde grootheden, startend van één. Wanneer de expandering optreed binnen dubbele-aanhalingstekens, geëxpandeerd het tot een enkel woord met de waarde van elke grootheid gescheiden door het eerste karakter van de bijzondere variabele .SM .B IFS Dus, "\fB$*\fP" is gelijk aan "\fB$1\fP\fIc\fP\fB$2\fP\fIc\fP\fB...\fP", waar .I c het eerste karakter is van de waarde van de .SM .B IFS variabele. Als .SM .B IFS niet is gezet worden de grootheden gescheiden door spaties. Als .SM .B IFS nul is worden de grootheden samengevoegd zonder tussenkomende scheiders. .TP .B @ Expandeert tot de plaatsbepaalde grootheden, startend van één. Wanneer de expandering optreed binnen dubbele-aanhalingstekens wordt elke grootheid geëxpandeerd tot een afzonderlijk woord. Dus, "\fB$@\fP" is gelijk aan "\fB$1\fP" "\fB$2\fP" ... Wanneer er geen plaatsbepaalde grootheden zijn, expanderen \fB$@\fP" en .B $@ tot niets (dat is, ze worden verwijderd). .TP .B # Expandeert tot het aantal plaatsbepaalde grootheden in decimalen. .TP .B ? Expandeert tot de status van de meest recent uitgevoerde voorgrond pijplijn. .TP .B \- Expandeert tot de huidige optie vlaggen zoals opgegeven bij aanroeping, door de ingebouwde .B set opdracht, of die door de shell zelf zijn gezet. (zoals de .B \-i optie). .TP .B $ Expandeert tot het proces ID van de shell. In een () sub-shell, geëxpandeerd het tot het proces ID van de huidige shell, niet de sub-shell. .TP .B ! Expandeert tot het proces ID van de meest recent uitgevoerde achtergrond (ongelijktijdige) opdracht. .TP .B 0 Expandeert tot de naam van de shell of shell script. Dit wordt gezet bij de shell initialisatie {#"initialization"#}. Als .B bash aangeroepen is met een bestand met opdrachten dan wordt .B $0 gezet naar de naam van dat bestand. Als .B bash gestart is met de .B \-c optie, dan wordt .B $0 gezet naar het eerste argument na het string dat uitgevoerd zal worden, als er één aanwezig is. Anders wordt het gezet naar de bestandnaam gebruikt om .BR bash , aan te roepen, zoals gegeven door argument nul. .TP .B _ Bij shell opstarten wordt dit gezet naar de absolute bestand naam van de shell of shell script dat uitgevoerd wordt zoals doorgegeven in de argumenten lijst. Daarna geëxpandeerd het naar het laatste argument van de vorige opdracht, na expandering. Ook gezet naar de volle bestandnaam van elke uitgevoerde opdracht en geplaatst in de omgeving overgedragen naar die opdracht. Bij ophalen van post bevat deze grootheid de naam van het post bestand dat momenteel bekeken wordt. .PD .SS Shell's Variabelen .PP De volgende variabelen zijn gezet door de shell: .PP .PD 0 .TP .B PPID Het proces ID van de shell's ouder. Deze variabele is alleen-lezen. .TP .B PWD De huidige werk directorie zoals gezet door de .B cd opdracht. .TP .B OLDPWD De vorige werk directorie zoals gezet door de .B cd opdracht. .TP .B REPLY Gezet naar de regel invoer gelezen door de .B read ingebouwde opdracht wanneer geen argumenten worden gegeven. .TP .B UID Expandeert tot het gebruiker ID van de huidige gebruiker, geïnitialiseerd bij shell opstarten. Deze variabele is alleen-lezen. .TP .B EUID Expandeert tot het geldige gebruiker ID van de huidige gebruiker, geïnitialiseerd bij shell opstarten. Deze variabele is alleen-lezen. .TP .B GROUPS Een tabel variabele die de lijst van groepen waar de huidige gebruiker lid van is bevat. Deze variabele is alleen-lezen. .TP .B BASH Expandeert tot de volle bestandnaam gebruikt om deze uitvoering van .BR bash " aan te roepen." .TP .B BASH_VERSION Expandeert tot een string die de versie van deze uitvoering van .BR bash " beschrijft." .TP .B BASH_VERSINFO Een alleen-lezen tabel variabele wiens leden versie informatie bevatten voor deze uitvoering van .BR bash . De waardes toegekend aan de tabel leden zijn als volgt: .sp .5 .RS .PD 0 .TP 24 .B BASH_VERSINFO[\fR0\fP] Het majeur versie nummer (de \fIvrijgave\fP {#"release"#}). .TP .B BASH_VERSINFO[\fR1\fP] Het mineur versie nummer (de \fIversie\fP). .TP .B BASH_VERSINFO[\fR2\fP] Het plak niveau {#"patch level"#}. .TP .B BASH_VERSINFO[\fR3\fP] De bouw versie. .TP .B BASH_VERSINFO[\fR4\fP] De vrijgave status (dat is, \fIbeta1\fP). .TP .B BASH_VERSINFO[\fR5\fP] De waarde van \fBMACHTYPE\fP {#machine soort#}. .PD .RE .TP .B SHLVL Elke keer verhoogt met 1 als een uitvoering van .B bash wordt gestart. .TP .B RANDOM Elke keer dat deze grootheid bekeken wordt, wordt een chaotisch heel getal tussen 0 en 32767 geproduceerd. De opeenvolging van chaotische nummers mag worden geïnitialiseerd door een waarde aan .SM .BR RANDOM " toe te kennen." Als .SM .B RANDOM ont-gezet verliest het zijn bijzondere eigenschappen, zelfs als het daarna her-zet wordt. .TP .B SECONDS Elke keer dat deze grootheid aangehaald wordt, wordt het aantal seconden sinds het aanroepen van de shell teruggegeven. Als een waarde is toegekend aan .SM .BR SECONDS , dan is de teruggegeven waarde bij volgende aanhalingen het aantal seconden sinds de toekenning plus de toegekende waarde. Als .SM .B SECONDS ont-gezet wordt verliest het zijn bijzondere eigenschappen, zelfs als het daarna wordt her-zet. .TP .B LINENO Elke keer dat deze grootheid aangehaald wordt vervangt de shell het met een decimaal nummer dat het huidige serie regel nummer (startend vanaf 1) binnen een script of functie. Wanneer niet in een script of functie, de vervangende waarde heeft niet gegarandeerd betekenis. Als .SM .B LINENO ont-gezet wordt verliest het zijn bijzondere eigenschappen, zelfs als het daarna wordt her-zet. .TP .B HISTCMD Het geschiedenis nummer, of de index in de geschiedenis lijst van de huidige opdracht. Als .SM .B HISTCMD ont-gezet wordt verliest het zijn bijzondere eigenschappen, zelfs als het daarna her-zet wordt. .TP .B DIRSTACK Een tabel variabele (zie .B Tabellen onder) die de huidige inhoud van de directorie stapel bevat. Directories verschijnen in de stapel in de volgorde waardin ze weergegeven worden door het .B directories ingebouwde. Toekennen aan leden van deze tabel variabele kan gebruikt worden om directories te veranderen die al op de stapel staan, maar de .B pushd en .B popd ingebouwden moeten gebruikt worden om directories toe te voegen of te verwijderen. Toekennen aan deze variabele zal de huidige directorie niet veranderen. Als .SM .B DIRSTACK ont-gezet wordt verliest het zijn bijzondere eigenschappen, zelfs als het daarna her-zet wordt. .TP .B PIPESTATUS Een tabel variabele (zie .B Tabellen onder) die een lijst bevat met einde status waardes van de processen in de meest recent uitgevoerde voorgrond pijplijn (die een enkele opdracht mag bevatten). .TP .B OPTARG De waarde van het laatste optie argument verwerkt door de .B getopts ingebouwde opdracht (zie .SM .B SCHELP INGEBOUWDE OPDRACHTEN onder). .TP .B OPTIND De index van het volgende argument dat verwerkt zal worden door de .B getopts ingebouwde opdracht (zie .SM .B SCHELP INGEBOUWDE OPDRACHTEN onder). .TP .B HOSTNAME Vanzelf gezet naar de naam van de huidige machine. .TP .B HOSTTYPE Vanzelf gezet naar het string dat een unieke beschrijving van het soort machine waar .B bash op draait geeft. Normaal is dat systeem-afhankelijk. .TP .B OSTYPE Vanzelf gezet naar het string dat het besturingssysteem beschrijft waar .B bash op draait. Normaal is dat systeem-afhankelijk. .TP .B MACHTYPE Vanzelf gezet naar een string dat volledig de systeem soort waar .B bash op draait beschrijft, in de standaard GNU \fIcpu-company-system\fP vorm. Normaal is dat systeem-afhankelijk. .TP .B SHELLOPTS Een met dubbele-punten gescheiden lijst van aangezette shell opties. Elk woord in de lijst is een geldig argument voor de .B \-o optie van de .B set ingebouwde opdracht (zie .SM .B "SCHELP INGEBOUWDE OPDRACHTEN" onder). De opties die in .SM .B SHELLOPTS verschijnen zijn dezelfde die als .I on {#aan#} gerapporteerd worden door \fBset \-o\fP. by \fBset \-o\fP. Als deze variabele in de omgeving is wanneer .B bash opstart, dan wordt elke shell optie in de lijst aangezet vóór het lezen van enige opstart bestanden. Deze variabele is alleen-lezen. .PD .PP De volgende variabelen worden gebruikt door de shell. In sommige gevallen kent .B bash een standaard waarde toe aan de variabele; deze gevallen worden opgemerkt onder. .PP .PD 0 .TP .B IFS De .I Internal Field Separator {#interne veld scheider#} die wordt gebruikt voor woord splitsen na expandering en om regels in woorden te splitsen met de .B read ingebouwde opdracht. De standaard waarde is ``''. .TP .B PATH De zoekweg voor opdrachten. Het is een dubbelepunt gescheiden lijst van directories waarin de shell zoekt naar opdrachten (zie .SM .B OPDRACHT UITVOERING onder). De standaard pad is systeem-afhankelijk, en wordt gezet door de administrator die .BR bash " installeert." Een wijdverbreide waarde is ``/usr/gnu/bin:/usr/local/bin:/usr/ucb:/bin:/usr/bin:.''. .TP .B HOME De thuis directorie van de huidige gebruiker; de het 'door-val' argument voor de \fBcd\fP ingebouwde opdracht. De waarde van deze variabele wordt ook gebruikt wanneer tilde expandering wordt uitgevoerd. .TP .B CDPATH De zoekpad voor de .B cd opdracht. Dit is een dubbele-punten gescheiden lijst van directories waarin de shell zoekt naar doel directories opgegeven door de .B cd opdracht. Een mogelijke waarde is ``.:~:/usr''. .TP .B BASH_ENV Als deze grootheid gezet is wanneer \fBbash\fP een shell script uitvoert wordt zijn waarde geïnterpreteerd als een bestandnaam die opdrachten bevat om de shell in te wijden, zoals in .IR ~/.bashrc . De waarde van .SM .B BASH_ENV is voorwerp voor grootheid expandering, opdracht substitutie, en rekenkundige expandering voordat het geïnterpreteerd wordt als een bestand naam. .SM .B PATH wordt niet gebruikt om de opgeleverde bestandnaam te zoeken. .TP .B MAIL Als deze grootheid gezet is naar een bestand naam en de .SM .B MAILPATH variabele is niet gezet dan informeert .B bash de gebruiker van het aankomen van post in het opgegeven bestand. .TP .B MAILCHECK Bepaald hoe vaak (in seconden) .B bash test op post. De standaard is 60 seconden. Wanneer het tijd is om voor post te testen, dan doet de shell dat vóór het weergeven van de belangrijkste {#"primary"#} prompt. Als deze variabele ongezet is dan zet de shell post testen uit. .TP .B MAILPATH Een dubbele-punten gescheiden lijst van bestandnamen die op post getest zullen worden. Het bericht dat afgedrukt zal worden wanneer post aankomt in een bepaald bestand kan opgegeven worden door de bestandnaam van het bericht te scheiden met een `?'. Wanneer gebruikt in de tekst van het bericht geëxpandeerd \fB$_\fP tot de naam van het huidige postbestand {#mailbox#}. Voorbeeld: .RS .PP \fBMAILPATH\fP='/usr/spool/mail/bfox?"U heeft post":~/shell\-mail?"$_ heeft post!"' .PP .B Bash levert een standaard waarde voor deze variabele, maar de plaats van de .\" stomme d/t regels gebruiker post bestanden die het gebruikt zijn systeem afhankelijk (dat is, /usr/spool/mail/\fB$USER\fP). .RE .TP .B PS1 De waarde van deze grootheid wordt geëxpandeerd (zie .SM .B PROMPTEN onder) en gebruikt als het belangrijkste prompt string. De standaard waarde is ``\fB\es\-\ev\e$ \fP''. .TP .B PS2 De waarde van deze grootheid wordt geëxpandeerd zoals met .B PS1 en wordt gebruikt als de tweede prompt string. De standaard is ``\fB> \fP''. .TP .B PS3 De waarde van deze grootheid wordt gebruikt als de prompt voor de .B select opdracht (zie .SM .B SCHELP SPELLING boven). .TP .B PS4 De waarde van deze grootheid wordt geëxpandeerd zoals met .B PS1 en de waarde wordt afgedrukt vóór elke opdracht die .B bash weergeeft tijdens een uitvoerings-volgen {#"trace"#}. Het eerste karakter van .SM .B PS4 wordt meerdere keren herhaald, als nodig, om meerder niveaus van omleiden aan te geven. De standaard is ``\fB+ \fP''. .TP .B TIMEFORMAT De waarde van deze grootheid wordt gebruikt voor het vorm string dat opgeeft hoe de tijdinformatie voor pijplijnen weergegeven moeten worden waar het .B time gereserveerde woord aan voorafgaat. Het \fB%\fP karakter begint een escape opeenvolging die geëxpandeerd wordt naar de tijd waarde of andere informatie. De escape opeenvolgingen en hun betekenissen zijn als volgt; de haakjes beschrijven niet vereiste gedeeltes. .sp .5 .RS .PD 0 .TP 10 .B %% Een letterlijke \fB%\fP. .TP .B %[\fIp\fP][l]R De verstreken tijd in seconden. .TP .B %[\fIp\fP][l]U Het aantal CPU seconden verbruikt in gebruiker mode. .TP .B %[\fIp\fP][l]S Het aantal CPU seconden verbruikt in systeem mode. .TP .B %P Het CPU percentage, berekend met (%U + %S) / %R. .PD .RE .IP De niet vereiste \fIp\fP is een cijfer dat de \fIprecisie\fP opgeeft, het aantal fractie cijfers na een tientallige punt. Een waarde van 0 veroorzaakt dat geen decimale punt en fractie worden weergegeven. Maximaal mogen drie plaatsen van de tientallige punt worden opgegeven; waardes van \fIp\fP groter dan 3 worden veranderd in 3. Als \fIp\fP niet opgegeven wordt, wordt de waarde 3 gebruikt. .IP De niet vereiste \fBl\fP geeft een langere vorm op die ook minuten bevat, in de vorm \fIMM\fPm\fISS\fP.\fIFF\fPs. De waarde van \fIp\fP bepaalt al of niet de fractie bijgevoegd wordt. .IP Als deze variabele niet is gezet, gedraagt \fBbash\fP zich alsof het de waarde \fB$'\enreal\et%3lR\enuser\et%3lU\ensys\t%3lS'\fP had. Als de waarde nul is worden geen tijdinformatie weergegeven. Een navolgende nieuwe regel wordt toegevoegd wanneer het vorm string weergegeven wordt. .TP .B HISTSIZE Het aantal opdrachten te onthouden in de opdrachten geschiedenis (zie .SM .B HISTORY onder). De standaard waarde is 500. .TP .B HISTFILE De naam van het bestand waarin de opdrachten geschiedenis wordt bewaard (zie .SM .B GESCHIEDENIS onder). De standaard waarde is \fI~/.bash_history\fP. Als ongezet wordt de opdrachten geschiedenis niet bewaard wanneer een interactieve shell eindigt. .TP .B HISTFILESIZE Het maximale aantal regels in het geschiedenis bestand. Wanneer deze variabele een waarde wordt toegekend wordt het geschiedenis bestand afgehakt als nodig om niet meer dan dat aantal regels te bevatten. De standaard waarde is 500. Het geschiedenis bestand wordt ook afgehakt naar deze maat na wegschrijven als een interactieve shell eindigt. .TP .B OPTERR Als gezet naar de waarde 1 geeft .B bash fout berichten weer die gemaakt zijn door de .B getopts ingebouwde opdracht (zie .SM .B SCHELP INGEBOUWDE OPDRACHTEN onder). .SM .B OPTERR is geïnitialiseerd als 1 elke keer dat de shell wordt aangeroepen of een shell script wordt uitgevoerd. .TP .B LANG Gebruikt om de localiteit categorie voor elke categorie niet expliciet gekozen met een variabele startend met \fBLC_\fP. .TP .B LC_ALL Deze variabele zet de waarde van \fBLANG\fP opzij en elke andere \fBLC_\fP variabele die een localiteit opgeeft. .TP .B LC_COLLATE Deze variabele bepaalt de regels, gebruikt bij het collationeren van de resultaten van padnaamexpandering, en bepaalt het gedrag van intervalexpressies, equivalentieklassen en gesorteerde reeksen binnen padnaamexpandering en patroon passen. .TP .B LC_CTYPE Deze variabele bepaalt de uitleg van karakters en het gedrag van karakter classes binnen padnaam expandering en patroon passen. .TP .B LC_MESSAGES Deze variabele bepaalt de localiteit gebruikt om dubbele-aanhalingstekens geciteerde strings voorafgegaan door een \fB$\fP. .TP .B PROMPT_COMMAND Als gezet wordt de waarde uitgevoerd als een opdracht vóór het neerzetten van de belangrijkste (eerste) prompt. .TP .B IGNOREEOF Controleert wat een interactieve shell doet bij ontvangst van een .SM .B EOF karakter als de enige invoer. Als gezet is de waarde het aantal aansluitende .SM .B EOF karakters die getypt moeten worden als de eerste karakters van een invoer regel vóór .B bash eindigt. Als de variabele bestaat maar geen numerieke waarde heeft, of helemaal geen waarde heeft is de standaard waarde 10. Als het niet bestaat betekend, .SM .B EOF het einde van de invoer voor de shell. .TP .B TMOUT Als gezet naar een waarde groter dan nul wordt de waarde geïnterpreteerd als het aantal seconden die gewacht moeten worden voor invoer na het neerzetten van de belangrijkste (eerste) prompt. .B Bash eindigt na het wachten van zoveel seconden als invoer niet binnenkomt. .TP .B FCEDIT De door-val editor voor de .B fc ingebouwde opdracht. .TP .B FIGNORE Een dubbele-punten gescheiden lijst van achtervoegsels die genegeerd worden bij het uitvoeren van bestandnaam completeren (zie .SM .B READLINE onder). Een bestandnaam wiens achtervoegsel overeenkomt met de zaken in .SM .B FIGNORE wordt buitengesloten van de lijst met gepaste bestandnamen. Een mogelijke waarde is ``.o:~''. .TP .B GLOBIGNORE Een dubbele-punten gescheiden lijst van patronen die de set bestandnamen bepaalt die genegeerd zullen worden bij padnaam expandering. Als een bestandnaam past op een padnaam expandering patroon ook past op één van de patronen in .SM .BR GLOBIGNORE , dan wordt het verwijderd van de lijst overeenkomsten. .TP .B INPUTRC De bestandnaam voor het .B readline opstart bestand, de standaard .FN ~/.inputrc opzij zettend (zie .SM .B READLINE onder). .TP .B HISTCONTROL Als gezet naar de waarde .IR ignorespace , worden regels die beginnen met een .B spatie karakter niet in de geschiedenis lijst gezet. Als gezet naar de waarde .IR ignoredups , worden regels die overeenkomen met de laatste geschiedenis regel niet bijgevoegd. De waarde .I ignoreboth combineert de twee mogelijkheden. Als niet gezet of als gezet naar enige andere waarde dan die boven worden alle regel gelezen door de verwerker bewaard in de geschiedenis lijst, voorwerp voor de waarde van .BR HISTIGNORE . Deze variabele zijn functie wordt overstegen door .BR HISTIGNORE . De tweede en volgende regels van een meerdere-regel gecompileerde opdracht worden niet getest, en worden bij de geschiedenis gevoegd wat de waarde van .BR HISTCONTROL " ook is." .TP .B HISTIGNORE Een dubbele-punten gescheiden lijst van patronen gebruikt om te beslissen welke opdracht regels bewaard moeten worden in de geschiedenis lijst. Elk patroon wordt verankerd bij het begin van de regel en moet volledig de regel opgeven (geen impliciete `\fB*\fP' wordt achtergevoegd). Elk patroon wordt getest tegen de regel nadat de tests opgegeven door .B HISTCONTROL zijn toegepast. In aanvulling op de normale shell patroon karakters, `\fB&\fP' komt overeen met de vorige geschiedenis regel. `\B&\fP' mag ge-escape't worden met gebruik van een backslash {#\#}. De backslash wordt verwijderd vóór proberen te passen. De tweede en volgende regels van een meerdere-regel gecompileerde opdracht worden niet getest, en worden gevoegd bij de geschiedenis geen acht slaande op de waarde van .BR HISTIGNORE . .TP .B histchars De twee of drie karakters die geschiedenis expandering en zaakmaken {#"tokenization"#} controleren (zie .SM .B GESCHIEDENIS VERGROTING onder). Het eerste karakter is het .IR "geschiedenis expandering karakter" het karakter dat het begin van geschiedenis expandering aangeeft, normaal `\fB!\fP'. Het tweed karakter is het .IR "snelle substitutie" karakter, dat wordt gebruikt als afkorting voor het her-draaien van de vorige gegeven opdracht, één string voor een ander vervangend in de opdracht. De door-val is `\fB^\fP'. Het niet vereiste derde karakter is het karakter dat aangeeft dat het overblijvende gedeelte van de regel een opmerking is wanneer gevonden als het eerste karakter van een woord, normaal `\fB#\fP'. Het geschiedenis opmerking karakter veroorzaakt dat geschiedenis substitutie wordt overgeslagen voor de rest van de woorden op de regel. Het maakt niet dat de shell's verwerker de rest van de regel noodzakelijk als een opmerking behandeld. .TP .B HOSTFILE Bevat de naam van een bestand in dezelfde vorm als .FN /etc/hosts dat gelezen zou moeten worden wanneer de shell een machinenaam moet completeren. Het bestand mag interactief veranderd worden; de volgende keer dat machinenaam completeren wordt geprobeerd .B bash voegt de inhoud van het nieuwe bestand toe aan de al bestaande database. .TP .B auto_resume Deze variabele controleert hoe de shell met de gebruiker en taak controle omgaat. Als deze variabele is gezet worden enkele woord simpele opdrachten zonder omleidingen behandeld als kandidaten voor doorgaan van een bestaande gestopte taak. Er wordt geen tweeslachtigheid toegestaan; als er meer dan één taak is die begint met de getypte taak wordt de meest recente taak gekozen. De .I naam van een gestopte taak, in deze context, is de opdracht regel gebruikt om het te starten. Als gezet naar de waarde .IR exact , moet het opgegeven string de naam van de gestopte taak exact passen; als gezet naar .IR sub-string , moet het opgegeven string een sub-string passen van de de naam van een gestopte taak. De .I sub-string waarde waarde levert diensten lijkend op de .B %? taak identificeerder (zie .SM .B TAAK CONTROLE onder). Als gezet naar enige andere waarde, moet het gegeven string een voorvoegsel zijn van een gestopte taak naam; dit levert diensten lijkend op de .B % taak identificeerder. .PD .SS Tabellen .B Bash levert één-dimensionale tabel variabelen. Elke variabele mag gebruikt worden als een tabel; de .B declare ingebouwde zal een tabel expliciet bekend maken. Er is geen maximum grens op de grootte van een tabel, nog enige vereiste dat de leden aansluitend ge-index't of toegekend moeten worden. Tabellen worden ge-index't met hele getallen en zijn nul-gebaseerd. .PP Een tabel wordt vanzelf gemaakt als enige variabele een waarde wordt toegekend met de spelling \fInaam\fP[\fIindex\fP]=\fIwaarde\fP. De .I index wordt behandeld als een rekenkundige expressie die een nummer moet opleveren groter of gelijk aan nul. Om expliciet een tabel bekend te maken, gebruik .B declare \-a \fInaam\fP (zie .SM .B SCHELP INGEBOUWDE OPDRACHTEN onder). .B declare \-a \fInaam\fP[\fIindex\fP] wordt ook geaccepteerd; de \fIindex\fP wordt genegeerd. Eigenschappen mogen opgegeven worden voor een tabel variabele met gebruik van de .B declare en .B readonly ingebouwden. Elke eigenschap gaat op voor alle leden van een tabel. .PP Aan tabellen wordt toegekend met gebruik van gecompileerde toekenningen van de vorm \fInaam \fInaam\fP=\fB(\fPwaarde\fI1\fP ... waarde\fIn\fP\fB)\fP, waar elke \fIwaarde\fP van de vorm [\fIindex\fP]=\fIstring\fP is. Alleen \fIstring\fP wordt vereist. Als De niet vereiste rechte haakjes en index worden gegeven wordt aan die index toegekend; anders aan de index van het element waaraan het laatst werd toegekend door een opdracht plus één. Indexen start bij nul. Deze spelling wordt ook geaccepteerd door de .B declare ingebouwde. Aan individuele tabel elementen mag worden toegekend met de \fInaam\fP[\fIindex\fP]=\fIwaard\fP spelling boven besproken. .PP Elk element van een tabel mag bezocht worden met ${\fInaam\fP[\fIindex\fP]}. De haakjes zijn nodig om ruzie met padnaam expandering te voorkomen. Als \fIindex\fP, \fB@\fP of \fB*\fP is, geëxpandeerd het woord tot alle leden van \fInaam\fP. Deze indexen verschillen alleen wanneer het woord in dubbele-aanhalingstekens verschijnt. Als het woord met dubbele aanhalingstekens is geciteerd geëxpandeerd ${\fInaam\fP[*]} tot een enkel woord met de waarde van elk tabel lid gescheiden door het eerste karakter van de .SM .B IFS bijzondere variabele, en ${\fInaam\fP[@]} geëxpandeerd elk element van \fInaam\fP naar een enkel woord. Wanneer er geen tabel leden zijn, geëxpandeerd ${\fInaam\fP[@]} tot niets. Dit is gelijksoortig met het expanderen van de bijzondere grootheden \fB*\fP en \fB@\fP (zie .B Bijzondere Grootheden boven). ${#\fInaam\fP[\fIindex\fP]} geëxpandeerd tot de lengte van ${\fInaam\fP[\fIindex\fP]}. Als \fIindex\fP, \fB*\fP of \fB@\fP is geëxpandeerd het tot het aantal elementen in de tabel. Bezoeken van een tabel variabele zonder een index is gelijk aan het bezoeken van element nul. .PP De .B unset ingebouwde wordt gebruikt om tabellen te vernietigen. \fBunset\fP \fBnaam\fP[\fIindex\fP] vernietigd het tabel element bij index \fIindex\fP. \fBunset\fP \fInaam\fP, waar \fInaam\fP een tabel is, of \fBunset\fP \fInaam\fP[\fIindex\fP], waar \fIindex\fP, \fB*\fP of \fB@\fP is, verwijderd de hele tabel. .PP De .BR declare , .BR local , en .B readonly ingebouwden accepteren elk een .B \-a optie om een tabel op te geven. De .B read ingebouwde accepteert een .B \-a optie om een lijst woorden gelezen van de standaard invoer toe te kennen aan een tabel. De .B set en .B declare ingebouwden geven tabel waardes weer op een manier die toestaat ze als toekenningen te gebruiken. .SH VERGROTING Expandering wordt uitgevoerd op de opdracht regel nadat het gesplitst is in woorden. Er worden zeven soorten expandering: .IR "haakjes expandering" , .IR "tilde expandering" , .IR "grootheid en variabele expandering" , .IR "opdracht substitutie" , .IR "rekenkundige expandering" , .IR "woord splitsen" , en .IR "padnaam expandering" . .PP De volgorde van expandering is: haakjes expandering, tilde expandering, grootheid expandering, variabele en rekenkundige expandering en opdracht substitutie (op van-links-naar-rechts manier), woord splitsen, ne padnaam expandering. .PP Op systemen die het ondersteunen is er nog een expandering beschikbaar: \fIproces substitutie\fP. .PP Alleen haakjes expandering, woord splitsen en padnaam expandering kunnen het aantal woorden van de expandering veranderen; andere expanderingen expanderen een enkel woord tot een enkel woord. De enige uitzondering voor dit zijn de expanderingen van "\fB$@\fP" en "\fB${\fP\fInaam\fP\fB[@]}\fP" zoals boven geïnterpreteerd (zie .SM .BR GROOTHEDEN ). .SS Haakjes Expandering .PP .I "Haakjes expandering" is een mechanisme waarmee willekeurige strings kunnen worden gemaakt. Dit mechanisme is gelijksoortig aan \fIpadnaam expandering\fP, maar de gemaakte bestandnamen hoeven niet te bestaan. Patronen die haakjes geëxpandeerd zullen worden nemen de vorm aan van een niet vereist .IR voorwoord , gevolgd door een serie komma-gescheiden strings tussen een paar haakjes, gevolgd door een niet vereist .IR nawoord . Het voorwoord wordt vooraan elk string dat de haakjes bevatten gezet, en het nawoord wordt achteraan elk opgeleverd string gezet, expanderend van links naar rechts. .PP Haakjes expandering mag genest worden. De resultaten van elke geëxpandeerd string worden niet gesorteerd; links naar rechts volgorde wordt behouden. Bijvoorbeeld, z\fB{\fPi,a,o\fB}\fPg geëxpandeerd tot `zig zag zog'. .PP Haakjes expandering wordt uitgevoerd vóór elke andere expandering, en elk karakter dat bijzondere betekenis heeft voor een andere expandering wordt behouden in het resultaat. Het is puur tekstueel. .B Bash past geen spellings uitleg toe op de context van de expandering of de text tussen de haakjes. .PP Een goed gevormde haakjes expandering moet ongeciteerde openende en sluitende haakjes bevatten, en tenminste één ongeciteerde komma. Elke niet goed gevormde haakjes expandering blijft onveranderd. Een \fB{\fP of \fB,\fP mag geciteerd worden met een backslash om te voorkomen dat het als een onderdeel van de haakjes expandering wordt gezien. .PP Dit bouwsel wordt typisch gebruikt als een afkorting wanneer het algemene voorvoegsel voor de strings langer is dan in het bovenstaande voorbeeld: .RS .PP mkdir /usr/local/src/bash/{old,new,dist,bugs} .RE of .RS chown root /usr/{ucb/{ex,edit},lib/{ex?.?*,how_ex}} .RE .PP Haakjes expandering introduceert een kleine niet-overeenkomst met historische versies van .BR sh . .B sh behandeld openende of sluitende haakjes niet bijzonder wanneer ze verschijnen als deel van een woord, en behoudt ze in de uitvoer. .B Bash verwijderd haakjes van woorden als gevolg van haakjes expandering. Bijvoorbeeld, een woord gegeven in .B sh als \fIbestand{1,2}\fP verschijnt overeenkomstig op de uitvoer. Hetzelfde woord wordt uitgevoerd als .I bestand1 bestand2 na expandering door .BR bash . Als precieze overeenkomst met .B sh verlangt wordt, start .B bash met de .B +B optie of maak haakjes expandering ongedaan met de .B +B optie voor de .B set opdracht (zie .SM .B SCHELP INGEBOUWDE OPDRACHTEN onder). .SS Tilde Expandering .PP Als een woord begint met een ongeciteerd tilde karakter (`\fB~\fP'), alle karakters voorafgaand aan de eerste ongeciteerde `slag' {#/#} (of alle karakters als er geen ongeciteerde slash is) als een \fItilde-voorvoegsel\fP genomen. Als geen van de karakters in het tilde-voorvoegsel zijn geciteerd, worden de karakters in het tilde-voorvoegsel volgend op de tilde behandeld als een mogelijke \fIinlog naam\fP. Als deze inlog naam een nul string is, wordt de tilde vervangen door de waarde van de shell grootheid .SM .BR HOME . Als .SM .B HOME ongezet is wordt de thuis directorie van de gebruiker die de shell draait in plaats daarvan ervoor in de plaats gezet. .PP Als het tilde-voorvoegsel een `~+' is, vervangt de waarde van shell variabele .SM .B PWD het tilde-voorvoegsel. Als het tilde-voorvoegsel een `~\-' is, wordt de waarde van de shell variabele .SM .BR OLDPWD , als gezet, ervoor in de plaats gezet. Als de karakters volgend op de tilde in het tilde-voorvoegsel bestaat uit een nummer \fIN\fP, eventueel voorafgegaan door een `+' of een `\-', dan wordt het tilde-voorvoegsel vervangen met het overeenkomende element van de directorie stapel, zoals zou worden weergegeven door de .B directories ingebouwde aangeroepen met het tilde-voorvoegsel als een argument. builtin invoked with the tilde-prefix as an argument. .PP Als de inlog naam ongeldig is, of als de tilde expandering faalt, blijft het woord onveranderd. .PP Elke variabele toekenning wordt getest voor ongeciteerde tilde-voorvoegsels onmiddellijk volgend op een .B : of .BR = . In deze gevallen wordt tilde expandering ook uitgevoerd. Dientengevolge kan men bestandnamen gebruiken met tildes in toekenningen aan .SM .BR PATH , .SM .BR MAILPATH , en .SM .BR CDPATH , en de shell kent de geëxpandeerde waarde toe. .SS Grootheid Expandering .PP Het `\fB$\fP' karakter introduceert grootheid expandering, opdracht substitutie, of rekenkundige expandering. De grootheid naam of symbool dat geëxpandeerd zal worden mag omsloten worden door haakjes, die niet zijn vereist maar dienen om de variabele te beschermen tegen expanderen met karakters die er onmiddellijk op volgen en geïnterpreteerd zouden worden als deel van de naam. .PP Wanneer haakjes worden gebruikt is het passende afsluitende haakje de eerste `\fB}\fP' die niet ge-escape't is door een backslash of binnen een geciteerd string staat, en niet binnenin een ingebedde rekenkundige expandering, opdracht substitutie of grootheid expandering. .PP .PD 0 .TP ${\fIgrootheid\fP} De waarde van \fIgrootheid\fP wordt vervangen. De haakjes zijn nodig wanneer de .I grootheid een plaatsbepaalde grootheid is met meer dan één cijfer, of wanneer .I grootheid gevolgd wordt door een karakter die niet geïnterpreteerd moet worden als deel van de naam. .PD .PP Als het eerste karakter van \fIgrootheid\fP een uitroepteken is dan wordt een niveau van variabele omleiden geïntroduceerd. \fBBash\fP gebruikt de waarde gevormd van de rest van \fIgrootheid\fP als de naam van een variabele; deze variabele wordt dan geëxpandeerd en die waarde gebruikt in de rest van de substitutie, in plaats van de waarde van \fIgrootheid\fP zelf. Dit status bekend als \fBindirecte expandering\fP. .PP In elk van de gevallen onder, \fIwoord\fP is voorwerp voor tilde expandering, grootheid expandering, opdracht substitutie en rekenkundige expandering. Wanneer geen sub-string expandering wordt uitgevoerd test \fBbash\fP voor een grootheid die niet is gezet of nul is; de dubbelepunt resultaten alleen weglatend in een test voor een ongezette grootheid. .PP .PD 0 .TP ${\fIgrootheid\fP\fB:\-\fP\fIwoord\fP} \fBGebruik Door-val Waardes\fP. Als .I grootheid is ongezet of nul, de expandering van .I woord wordt er dan voor in de plaats gezet. Anders wordt de waarde van .I grootheid ervoor in de plaats gezet. .TP ${\fIgrootheid\fP\fB:=\fP\fIwoord\fP} \fBKen Door-val Waardes Toe\fP. Als .I grootheid ongezet of nul is, wordt de expandering van .I woord toegekend aan .IR grootheid . De waarde van .I grootheid wordt er dan voor in de plaats gezet. Aan plaatsbepaalde grootheden en bijzondere grootheden mag niet worden toegekend op deze manier. .TP ${\fIgrootheid\fP\fB:?\fP\fIwoord\fP} \fBWeergave Fout als Nul of Ongezet\fP. Als .I grootheid nul of ongezet is wordt de expandering van \fIwoord\fP (of een bericht van die strekking als .I woord niet aanwezig is) geschreven naar de standaard fout-uitvoer van de shell en de shell, als die niet interactief is, eindigt. Anders wordt de waarde van \fIgrootheid\fP ervoor in de plaats gezet. .TP ${\fIgrootheid\fP\fB:+\fP\fIwoord\fP} \fBGebruik Andere Waarde\fP. Als .I grootheid nul is of ongezet, wordt niets in de plaats gezet, anders wordt de expandering van .I woord ervoor in de plaats gezet. .TP .PD 0 ${\fIgrootheid\fP\fB:\fP\fIvanaf\fP} .TP ${\fIgrootheid\fP\fB:\fP\fIvanaf\fP\fB:\fP\fIlengte\fP} .PD \fBSub-string Expandering.\fP Expandeert tot aan \fIlengte\fP karakters van \fIgrootheid\fP, startend bij de karakters opgegeven door \fIvanaf\fP. Als \fIlengte\fP weggelaten wordt, geëxpandeerd het tot het sub-string van If \fIlength\fP is omitted, expands to the substring of \fIgrootheid\fP, startend bij het karakter opgegeven door \fIvanaf\fP. \fIlengte\fP and \fIvanaf\fP zijn rekenkundige expressies (zie .SM .B REKENKUNDIGE BEOORDELING onder). \fIlengte\fP moet oplossen in een getal groter dan of gelijk aan nul. Als \fIvanaf\fP oplost tot een getal kleiner dan nul wordt de waarde gebruikt als een vanaf-waarde vanaf het einde van de waarde van \fIgrootheid\fP. Als \fIgrootheid\fP, \fB@\fP is, levert dat \fIlengte\fP plaatsbepaalde grootheden beginnend bij \fIvanaf\fP. Als \fIgrootheid\fP een tabel naam is ge-index't door @ of *, levert dat de \fIlengte\fP leden van de tabel beginnend bij ${\fIgrootheid\fP[\fIvanaf\fP]}. Sub-string indexen zijn nul gebaseerd tenzij plaatsbepaalde grootheden worden gebruikt, in welk geval het indexen start bij 1. .TP ${\fB#\fP\fIparameter\fP} De lengte in karakters van de waarde van \fIgrootheid\fP wordt hiervoor in de plaats gezet. Als .I grootheid .B * of .BR @ " is," is de waarde die ervoor in de plaats gezet wordt het aantal plaatsbepaalde grootheden. Als .I grootheid een tabel naam met index .B * of .BR @ " is," wordt de ervoor in de plaats gezette waarde het aantal elementen in de tabel. .TP .PD 0 ${\fIgrootheid\fP\fB#\fP\fIwoord\fP} .TP ${\fIgrootheid\fP\fB##\fP\fIwoord\fP} .PD Het .I woord wordt geëxpandeerd een patroon opleverend net als bij padnaam expandering. Als het patroon past op het begin van de waarde van .IR grootheid , dan levert de expandering de geëxpandeerde waarde van .I grootheid met het kortste passende patroon (het ``\fB#\fP'' geval) of het langste passende patroon (het ``\fB##\fP''geval) geschrapt. Als .I grootheid .B @ of .BR * " is," wordt het patroon verwijderen om de beurt toegepast op elke plaatsbepaalde patroon, en de expandering is de opgeleverde lijst. Als .I grootheid een tabel variabele is ge-index't met .B @ of .BR * , dan wordt het patroon verwijderen om de beurt toegepast op elk lid van de tabel, en de expandering is de opgeleverde lijst. .TP .PD 0 ${\fIgrootheid\fP\fB%\fP\fIwoord\fP} .TP ${\fIgrootheid\fP\fB%%\fP\fIwoord\fP} .PD Het \fIwoord\fP wordt geëxpandeerd om een patroon te leveren net als in padnaam expandering. Als het patroon een achteraan hangend deel van de geëxpandeerde waarde van .IR grootheid " past," dan levert de expandering de geëxpandeerde waarde van .I grootheid met het kortste passende patroon (het ``\fB%\fP'' geval) of het langste passende patroon (het ``\fB%%\fP'' geval) geschrapt. Als .I grootheid .B @ of .BR * " is," wordt het patroon verwijderen toegepast op elke plaatsbepaalde grootheid om de beurt, en de expandering is de opgeleverde lijst. Als .I grootheid een tabel variabele ge-index't met .B @ of .BR * " is," het patroon verwijderen wordt op elk lid toegepast van de tabel om de beurt, en de expandering is de opgeleverde lijst. .TP .PD 0 ${\fIgrootheid\fP\fB/\fP\fIpatroon\fP\fB/\fP\fIstring\fP} .TP ${\fIgrootheid\fP\fB//\fP\fIpatroon\fP\fB/\fP\fIstring\fP} .PD Het \fIpatroon\fP wordt geëxpandeerd om een patroon te produceren net als in padnaam expandering. \fIGrootheid\fP wordt geëxpandeerd en de langste overeenkomst van \fIpatroon\fP met zijn waarde wordt vervangen met \fIstring\fP In de eerste vorm, wordt alleen de eerste overeenkomst vervangen. De tweede vorm zorgt dat alle overeenkomsten van \fIpatroon\fP worden vervangen met \fIstring\fP. Als \fIpatroon\fP begint met \fB#\fP, moet het passen bij het begin van de geëxpandeerde waarde van \fIgrootheid\fP. Als \fIpatroon\fP start met \fB%\fP, moet het passen bij het eind van de geëxpandeerde waarde van \fIgrootheid\fP. Als \fIstring\fP nul is, worden overeenkomsten van \fIpatroon\fP geschrapt en de \fB/\fP volgend op \fIpatroon\fP mag weggelaten worden. Als .I grootheid .B @ of .BR * " is," wordt het vervangen toegepast op elke plaatsbepaalde grootheid om de beurt, en de expandering is de opgeleverde lijst. Als .I grootheid een tabel variabele ge-index't met .B @ of .BR * " is," wordt het vervangen toegepast op elk lid van de tabel om de beurt, en de expandering is de opgeleverde lijst. .SS Opdracht Vervanging .PP \fIOpdracht Vervanging\fP laat toe dat de uitvoer van een opdracht de opdracht-naam vervangt. Er zijn twee vormen: .PP .RS .PP \fB$(\fP\fIopdracht\fP\|\fB)\fP .RE of .RS \fB`\fP\fIopdracht\fP\fB`\fP .RE .PP .B Bash verricht de expandering door \fIopdracht\fP uit te voeren en de opdracht-substitutie te vervangen door de standaard uitvoer van de opdracht, met mogelijke achter-hangende nieuweregels geschrapt. Ingebedde nieuweregels worden niet geschrapt, maar ze kunnen verwijderd worden gedurende woord splitsen. De opdracht substitutie \fB$(cat \fIbestand\fP)\fR kan vervangen worden door het gelijk werkende maar snellere \fB$(< \fIbestand\fP)\fR. .PP Wanneer de oude stijl terug-aanhalingsteken {#`#} wordt gebruikt behoud een backslash {#\#} zijn letterlijke betekenis wanneer gevolgd door .BR $ , .BR ` , of .BR \e . De eerste backslash niet voorafgaand door een backslash beëindigd de opdracht substitutie. Wanneer de $(\^\fIopdracht\fP\|) vorm wordt gebruikt, horen alle karakters tussen de haakjes bij de opdracht; geen worden bijzonder behandeld. .PP Opdracht substitutie mag genest worden. Nesten met het terug-aanhalingsteken werkt door de binnenste terug-aanhalingstekens het backslashes uit te vluchten. .PP Als de substitutie verschijnt binnen dubbele aanhalingstekens wordt woord-splitsen en padnaam expandering niet uitgevoerd op de resultaten. .SS Rekenkundige Expandering .PP Rekenkundige expandering status de oplossing van een rekenkundige expressie en het ervoor in de plaats zetten van het resultaat toe. D vorm voor rekenkundige expandering is: .RS .PP \fB$((\fP\fIexpressie\fP\fB))\fP .RE .PP De .I expressie wordt behandeld alsof het binnen dubbele aanhalingstekens verscheen, maar een dubbel aanhalingsteken {#"#} binnen haakjes wordt niet bijzonder behandeld. Alle zaken in de expandering ondergaan grootheid expandering, string expandering, opdracht substitutie en aanhalingsteken verwijdering. Rekenkundige substituties mogen genest worden .PP De oplossing wordt gedaan volgens de regels onder opgesomd bij .SM .BR "REKENKUNDIGE OPLOSSING" . Als .I expressie ongeldig is drukt .B bash een bericht af dat de fout aangeeft, en geen substitutie treed op. .SS Proces Vervanging .PP \fIProces substitutie\fP wordt ondersteunt op systemen die benoemde pijpen ondersteunen (\fIFIFOs\fP) of de \fB/dev/fd\fP methode voor het benoemen van open bestanden. Het neemt de vorm \fB<(\fP\fIlijst\^\fP\fB)\fP of \fB>(\fP\fIlijst\^\fP\fB)\fP. Het proces \fIlijst\fP wordt gedraaid met zijn invoer of uitvoer verbonden met een \fIFIFO\fP of met een of ander bestand in \fB/dev/fd\fP. De naam van dit bestand wordt doorgegeven als een argument aan de huidige opdracht als het resultaat van de expandering. Als de \fB>(\fP\fIlijst\^\fP\fB)\fP vorm wordt gebruikt zal schrijven naar het bestand invoer voor \fIlijst\fP leveren. Als de \fB<(\fP\fIlijst\^\fP\fB)\fP vorm wordt gebruikt zal het doorgegeven bestand gelezen moeten worden om de uitvoer van \fIlijst\fP te verkrijgen. .PP Wanneer beschikbaar, wordt \fIproces substitutie\fP gedaan gelijktijdig met grootheid en variabele expandering, opdracht substitutie, en rekenkundige substitutie. .SS Woord Splitsen .PP De shell onderzoekt het resultaat van grootheid expandering, opdracht substitutie, en rekenkundige expandering die niet optrad binnen dubbele aanhalingstekens voor .IR "woord splitsen" . .PP De shell behandeld elk karakter van .SM .B IFS als een begrenser, en deelt de resultaten van de andere expanderingen in woorden met deze karakters. Als .SM .B IFS ongezet is, of als zijn waarde precies .BR " is," de standaard, dan dient elke opeenvolging van .SM .B IFS karakters om woorden te begrenzen. Als .SM .B IFS een andere waarde dan de standaard heeft, dan worden opeenvolgingen van de witruimte karakters .B spatie en .B tabulatie genegeerd bij het begin en einde van het woord, zolang als het witte ruimte karakter in de waarde van .SM .BR IFS is (een .SM .B IFS witruimte karakter). Elk karakter in .SM .B IFS dat niet .SM .B IFS witruimte is, samen met elk aangrenzend .SM .B IFS witruimte karakter, begrensd een veld. Een opeenvolging van .SM .B IFS witruimte karakters wordt ook behandeld als een begrenser. Als de waarde van .SM .B IFS nul is treed geen woord splitsen op. .PP Expliciete nul argumenten (\^\f3"\^"\fP of \^\f3'\^'\fP\^) blijven behouden. Ongeciteerde impliciete nul argumenten resulterend van de expandering van .I grootheden die geen waardes hebben worden verwijderd. Als een grootheid met geen waarde wordt geëxpandeerd binnen dubbele aanhalings tekens blijft een nul argument behouden. .PP Merk op dat als geen expandering optreed, geen splitsen uitgevoerd wordt. .SS padnaam splitsen .PP Na woord splitsen, tenzij de .B \-f optie gezet is, onderzoekt .B bash elk woord op de karakters .BR * , .BR ? , .BR ( , en .BR [ . Als een van deze karakters voorkomt dan wordt het woord beschouwd als een regarded as a .IR patroon , en vervangen met de alphabetisch gesorteerde lijst van bestandnamen die het patroon passen. Als geen overeenkomstige bestandnamen zijn gevonden, en de shell optie .B nullglob uit status blijft het woord onveranderd. Als de .B nullglob optie gezet is, en geen overeenkomsten zijn gevonden, wordt het woord verwijderd. Als de shell optie .B nocaseglob aan status wordt de passing uitgevoerd zonder acht te slaan op het verschil tussen hoofd- en kleine- letters. Wanneer een patroon wordt gebruikt voor padnaam expandering moet het karakter .B ``.'' bij het begin van een naam of onmiddellijk volgend op een slash {#/#} expliciet passen, tenzij de shell optie .B dotglob gezet is. Bij passen op een padnaam moet het slash karakter altijd expliciet passen. In andere gevallen wordt het .B ``.'' karakter niet bijzonder behandeld. Zie de beschrijving van .B shopt onder bij .SM .B SCHELP INGEBOUWDE OPDRACHTEN voor een beschrijving van de .BR nocaseglob , .BR nullglob , en .B dotglob shell opties. .PP De .SM .B GLOBIGNORE shell variabele mag gebruikt worden om set bestandnamen die gepast worden met een .IR patroon te beperken. Als .SM .B GLOBIGNORE gezet wordt wordt elke passende die ook past op één van de patronen in .SM .B GLOBIGNORE verwijderd uit de lijst van overeenkomsten. De bestand namen .B ``.'' en .B ``..'' worden altijd genegeerd, zelfs wanneer .SM .B GLOBIGNORE gezet is. Echter, het zetten van .SM .B GLOBIGNORE heeft de werking dat het de .B dotglob shell optie aan zet, dus alle andere bestandnamen die beginnen met een .B ``.'' zullen passen. Om het oude gedrag van het negeren van bestandnamen beginnend met een .BR ``.'' , weer te verkrijgen, maak .B ``.*'' één van de patronen in .SM .BR GLOBIGNORE . De .B dotglob optie wordt uitgezet wanneer .SM .B GLOBIGNORE ongezet is. .PP \fBPatroon Passen\fP .PP Elk karakter dat opduikt in een patroon, anders dan de bijzondere patroon karakters beschreven onder, passen zichzelf. Het NUL karakter mag niet voorkomen in een patroon. De bijzondere patroon karakters moeten geciteerd worden als ze zichzelf letterlijk moeten passen. .PP De bijzondere karakters hebben de volgende betekenis: .PP .PD 0 .TP .B * Past elk string, ook het nul string. .TP .B ? Past elk enkel karakter .TP .B [...] Past elk van de omsloten karakters. Twee karakters gescheiden door een min {#-#} teken betekend een .IR interval ; elk karakter volgens het woordenboek tussen deze twee karakters, inclusief, wordt gepast. Als het eerste karakter volgend op de .B [ een .B ! of een .B ^ is dan elk karakter .B niet omsloten wordt gepast. Een .B \- mag gepast worden door het bij te voegen als het eerste of laatste karakter in de set. Een .B ] mag gepast worden door het bij te voegen als het eerste karakter in de set. .br .if t .sp 0.5 .if n .sp 1 Binnen .B [ en .BR ] , kunnen \fIkarakter classes\fP opgegeven worden met de spelling: \fB[:\fP\fIklasse\fP\fB:]\fP, waar \fIklasse\fP één van de volgende classes is, bepaalt in de POSIX.2 standaard: .PP .RS .B .if n alnum alpha ascii blank cntrl digit graph lower print punct space upper xdigit .if t alnum alpha ascii blank cntrl digit graph lower print punct space upper xdigit .br Een karakter klasse past elk karakter dat bij de klasse hoort. .br .if t .sp 0.5 .if n .sp 1 Binnen .B [ en .BR ] , kan een \fIgelijke klasse\fP opgegeven worden met de spelling \fB[=\fP\fIc\fP\fB=]\fP, dat alle karakters past met hetzelfde collatie-gewicht (zoals bepaald door de huidige localiteit) als het karakter \fIc\fP. .br .if t .sp 0.5 .if n .sp 1 Binnen .B [ en .BR ] , past \fB[.\fP\fIsymbool\fP\fB.]\fP het collatiesymbool \fIsymbool\fP. .RE .PD .PP Als de \fBextglob\fP shell optie aan status via de \fBshopt\fP ingebouwde, worden meerdere uitgebreide patroon passing operatoren herkend. In de volgende beschrijving, is een \fIpatroon\-lijst\fP een lijst van één of meer patronen gescheiden door een \fB|\fP. Gecompileerde patronen mogen gevormd worden met één of meer van de volgende sub-patronen: .sp 1 .PD 0 .RS .TP \fB?(\fP\^\fIpatronen-lijst\^\fP\fB)\fP Past nul of één optreding van het gegeven patronen. .TP \fB*(\fP\^\fIpatroon-lijst\^\fP\fB)\fP Past nul of meerdere optredingen van de gegeven patronen. .TP \fB+(\fP\^\fIpatroon-lijst\^\fP\fB)\fP Past één of meerdere optredingen van het gegeven patroon. .TP \fB@(\fP\^\fIpatroon-lijst\^\fP\fB)\fP Past precies één van de gegeven patronen .TP \fB!(\fP\^\fIpatroon-lijst\^\fP\fB)\fP Past wat dan ook behalve het gegeven patroon .RE .PD .SS Aanhalings Verwijdering .PP Na de voorgaande expandering worden alle ongeciteerde optredingen van de karakters .BR \e , .BR ' , en \^\f3"\fP\^ die niet resulteerden van één van de bovenstaande expanderingen verwijderd. .SH HERRICHTING Vóór een opdracht wordt uitgevoerd wordt mag zijn invoer en uitvoer .I omgeleid worden met een bijzondere notatie, geïnterpreteerd door de shell. Omleiden mag ook gebruikt worden om bestanden te openen en sluiten voor de huidige shell uitvoering omgeving. De volgende omleiding operatoren mogen voorgaan aan, of overal binnen een .I simpele opdracht verschijnen, of mag de .IR opdracht volgen. Omleidingen worden verwerkt in de volgorde waarin ze verschijnen, van links naar rechts. .PP In de volgende beschrijvingen, als het bestandindicator nummer wordt weggelaten, en het eerste karakter van de omleiding operator .BR < " is," dan verwijst de omleiding naar de standaard invoer (bestand indicator 0). Als het eerste karakter van de omleiding operator .BR > " is," dan verwijst de omleiding naar de standaard uitvoer (bestand indicator 1). .PP Het woord volgend op de omleiding operator in de volgende beschrijvingen, tenzij anders vermeld, is voorwerp voor haakjes expandering, tilde expandering, grootheid expandering, opdracht substitutie, rekenkundige expandering, aanhalingsteken expandering, en padnaam expandering. Als het geëxpandeerd tot meer dan één woord rapporteert .B bash een fout. .PP Merk op dat de volgorde van omleidingen belangrijk is. Bijvoorbeeld de opdracht: .RS .PP ls \fB>\fP dirlijst 2\fB>&\fP1 .RE .PP richt standaard uitvoer en standaard fout uitvoer allebei naar het bestand .IR directorie-lijst , terwijl de opdracht .RS .PP ls 2\fB>&\fP1 \fB>\fP directorie-lijst .RE .PP alleen de standaard uitvoer naar bestand .IR directorie-lijst verwijst, omdat de standaard fout uitvoer werd kopieert als standaard uitvoer vóór de standaard uitvoer omgeleid was naar because the standard error was duplicated as standard output before the standard output was redirected to .IR directorie-lijst . .PP Een falen in het openen of maken van een bestand zorgt dat het omleiden faalt. .SS Omleiden Invoer .PP Omleiding van invoer zorgt dat een bestand wiens naam resulteerde van de expandering van .I woord wordt geopend voor lezen met bestandindicator .IR n , of de standaard invoer (bestand indicator 0) als .I n niet is opgegeven. .PP De algemene vorm voor omleiden van invoer is: .RS .PP [\fIn\fP]\fB<\fP\fIwoord\fP .RE .SS Omleiden Uitvoer .PP Omleiden van uitvoer zorgt dat het bestand wiens naam resulteert van de expandering van .I woord wordt geopend voor schrijven met bestandindicator .IR n , of de standaard uitvoer (bestand indicator 1) als .I n niet is opgegeven. Al het bestand niet bestaat wordt het gemaakt; als het bestaat wordt het afgehakt tot grootte nul. .PP De algemene vorm voor omleiden van uitvoer is: .RS .PP [\fIn\fP]\fB>\fP\fIwoord\fP .RE .PP Als de omleiden operator .BR > " is," en de .B noclobber optie voor de .B set ingebouwde aangezet is zal het omleiden falen als de bestandnaam wiens naam resulteerde van het expanderen van \fIwoord\fP bestaat en een normaal bestand is. Als de omleiding operator .BR >| " is," of de omleiding operator is .B > en de .B noclobber optie voor de .B set ingebouwde opdracht niet aan staat, dan zal het omleiden gepoogd worden, zelfs als het bestand genaamd \fIwoord\fP bestaat. .SS Toevoegen Omgeleide Uitvoer .PP Omleiden van uitvoer op deze manier zorgt dat het bestand wiens naam resulteerde van de expandering van .I woord wordt geopend voor toevoeging met bestand indicator .IR n , of de standaard uitvoer (bestand indicator 1) als .I n niet werd opgegeven. Als het bestand niet bestaat wordt het gemaakt. .PP De algemene vorm voor toevoegen van uitvoer is: .RS .PP [\fIn\fP]\fB>>\fP\fIwoord\fP .RE .PP .SS Omleiding Standaard Uitvoer en Standaard Fouten .PP .B Bash laat toe dat de standaard uitvoer (bestand indicator 1) en de standaard fouten uitvoer (bestand indicator 2) allebei worden omgeleid naar het bestand wiens naam de expandering van .I woord is, met dit bouwsel. .PP Er zijn twee vormen voor omleiden van standaard uitvoer en standaard fouten: .RS .PP \fB&>\fP\fIwoord\fP .RE en .RS \fB>&\fP\fIwoord\fP .RE .PP Van de twee vormen heeft de eerste de voorkeur. Dit is qua betekenis gelijk aan .RS .PP \fB>\fP\fIwoord\fP 2\fB>&\fP1 .RE .SS Hier Documenten .PP Dit soort omleiding draagt de shell op om de invoer te lezen van de huidige bron totdat een regel die alleen .I wordt (zonder aanhangende witruimte) bevat wordt gezien. Alle regel gelezen tot aan dat punt worden dan gebruikt als de standaard invoer voor een opdracht. .PP De vorm van hier-documenten is als volgt: .RS .PP .nf \fB<<\fP[\fB\-\fP]\fIwoord\fP \fIhier\-document\fP \fIbegrenser\fP .fi .RE .PP Geen grootheid expandering, opdracht substitutie, padnaam expandering, of rekenkundige expandering wordt uitgevoerd op .IR woord . Als enig(e) karakter(s) in .I woord wordt geciteerd, is de .I begrenser het resultaat van de citerings verwijdering op .IR woord , en de regels in het hier-document worden niet geëxpandeerd. If \fIwoord\fP ongeciteerd is worden alle regels in het hier-document voorwerp voor grootheid expandering, opdracht substitutie, en rekenkundige expandering. In het laatste geval wordt .B \e genegeerd en moet .B \e gebruikt worden om de karakters te citeren .BR \e , .BR $ , en .BR ` . .PP Als de omleiding operator .BR <<\- , is, dan worden alle voorafgaande tabulatie karakters verwijderd van invoer regels en de regel die .IR begrenzing " bevat." Dit laat toe dat hier-documenten binnen shell scripts kunnen worden ingesprongen op een natuurlijke manier. .SS "Kopiëren Bestandsindicators" .PP De omleiding operator .RS .PP [\fIn\fP]\fB<&\fP\fIwoord\fP .RE .PP wordt gebruikt om invoer bestandsindicators te kopiëren. Als .I woord geëxpandeerd tot één of meer cijfers wordt de bestandsindicator opgegeven met .I n een kopie van die bestandsindicator. Als de cijfers in .I woord niet een bestand indicator beschrijven die open is voor invoer, dan treed een omleiding fout op. Als .I woord oplost in .BR \- , wordt bestand indicator .I n gesloten. Als .I n niet is opgegeven wordt de standaard invoer (bestand indicator 0) gebruikt. .PP De operator .RS .PP [\fIn\fP]\fB>&\fP\fIwoord\fP .RE .PP wordt gelijksoortig gebruikt om uitvoer bestandindicator te kopiëren. Als .I n niet is opgegeven wordt de standaard uitvoer (bestand indicator 1) gebruikt. Als de cijfers in .I woord niet een bestand indicator opgeven die open is voor invoer treed een omleiding fout op. Een speciaal geval is als \fIn\fP wordt weggelaten, en \fIwoord\fP niet geëxpandeerd tot één of meer cijfers wordt de standaard uitvoer en standaard fouten omgeleid als hiervoor beschreven. .SS "Openen Bestandsindicatoren Voor Lezen en Schrijven" .PP De omleiding operator .RS .PP [\fIn\fP]\fB<>\fP\fIwoord\fP .RE .PP zorgt dat het bestand wiens naam de expandering van .I woord is, wordt geopend voor lezen en schrijven op bestand indicators .IR n , of op bestand indicator 0 als .I n niet is opgegeven. Als het bestand niet bestaat wordt het gemaakt. .SH ALIASEN Aliasen laten een string toe om vervangen te worden door een woord wanneer het gebruikt wordt als het eerste woord van een simpele opdracht. De shell houdt een lijst van .I aliasen bij die gezet en ontzet mogen worden met de .B alias en .B unalias ingebouwde opdrachten (zie .SM .B SCHELP INGEBOUWDE OPDRACHTEN onder). Het eerste woord van elke opdracht, als ongeciteerd, wordt getest om te zien of het een alias heeft. Als dat het geval is wordt het woord vervangen door de tekst van de alias. D alias naam en de vervangende tekst mogen alle geldige shell invoer bevatten, ook de .I metakarakters boven opgenoemd, met de uitzondering dat de alias naam geen \fI=\fP mag hebben. Het eerste woord van de vervangende tekst wordt getest op aliasen, maar een woord dat gelijk is aan een alias dat geëxpandeerd wordt, wordt niet nog een keer geëxpandeerd. Dit betekend dat je .B ls naar .BR "ls \-F" , mag aliassen bijvoorbeeld, en .B bash probeert niet om de vervangende tekst herhaaldelijk te expanderen. Als het laatste karakter van de alias waarde een .IR lege-ruimte " {#blank#} is," dan wordt het volgende opdracht woord wordt ook getest voor alias expandering. .PP Aliassen worden gemaakt en opgesomd met de .B alias opdracht, en verwijderd met de .B unalias opdracht. .PP Er is geen mechanisme voor het gebruiken van argumenten in de vervangende text. Als argumenten nodig zijn moet een shell functie worden gebruikt. .PP Aliassen worden niet geëxpandeerd wanneer de shell niet interactief is, tenzij de .B expand_aliases shell optie is gezet met .B shopt (zie de beschrijving voor .B shopt onder .SM \fBSCHELP INGEBOUWDE OPDRACHTEN\fP onder). .PP Di regels met betrekking tot het gebruik en definitie van aliassen zijn soms wat verwarrend. .B Bash leest altijd tenminste één hele regel invoer vóór het uitvoeren van de opdrachten op die regel. Aliassen worden geëxpandeerd wanneer een opdracht gelezen wordt, niet wanneer het wordt uitgevoerd. Daarom heeft een alias definitie die verschijnt op dezelfde regel als een andere opdracht geen gelding totdat de volgende regel invoer gelezen wordt. De opdrachten volgend op de alias definitie op die regel worden niet beïnvloed door het nieuwe alias. Dit gedrag is ook een kwestie wanneer functies worden uitgevoerd. Aliassen worden geëxpandeerd wanneer een functie definitie wordt gelezen, niet wanneer de functie wordt uitgevoerd omdat een functie definitie zelf een gecompileerde opdracht is. Als gevolg daarvan zijn aliasen die gedefinieerd zijn in een functie niet beschikbaar tot na die functie is uitgevoerd. Om veilig te zijn, zet alias definities op een afzonderlijke regel, en gebruik .B alias niet in gecompileerde {#compound#} opdrachten. .PP Voor bijna elk doel worden aliassen overstegen door shell functies. .SH FUNCTIES Een shell functie, gedefinieerd zoals beschreven boven onder .SM .BR "SCHELP SPELLING" , bewaard een serie opdrachten voor latere uitvoering. Functies worden uitgevoerd in de context van de huidige shell; geen nieuw proces wordt gemaakt om ze uit te leggen (in tegenstelling tot de uitvoering van een shell script {#script#}). Wanneer een functie wordt uitgevoerd, worden de argumenten voor de functie de plaatsbepaalde parameters gedurende zijn uitvoering. De speciale grootheid .B # wordt bijgewerkt om de verandering weer te geven. Plaatsbepaalde grootheid 0 blijft onveranderd. Alle andere aspecten van de shell's uitvoering omgeving blijven gelijk tussen een functie en zijn aanroeper met de uitzondering dat de .SM .B DEBUG val (zie de beschrijving van de .B trap ingebouwde onder .SM .B SCHELP INGEBOUWDE OPDRACHTEN onder) niet wordt geërfd. .PP Variabelen locaal voor de functie mogen bekend gemaakt worden met de .B local ingebouwde opdracht. Normaal gesproken worden variabelen en hun waardes gedeeld tussen de functie en zijn aanroeper. .PP Als de ingebouwde opdracht .B return uitgevoerd wordt in een functie, dan eindigt de functie en uitvoering hervat met de volgende opdracht na de functie aanroep. Wanneer een functie eindigt worden de plaatsbepaalde grootheden en de bijzondere grootheid .B # hersteld tot de waardes die ze hadden vóór de functies uitvoering. .PP Functie namen en definities mogen opgesomd met de .B \-f optie voor de .B declare of .B typeset ingebouwde opdrachten. De .B \-F optie voor .B declare of .B typeset zal alleen de functie namen opsommen. Functies mogen ge-exporteerd worden zodat sub-shell's ze automatisch gedefinieerd hebben met de .B \-f optie voor de .B export ingebouwde. .PP Functies mogen herhaaldelijk {#recursive#} zijn. Geen grens wordt afgedwongen op het aantal herhaaldelijke aanroepen. .SH "REKENKUNDIGE OPLOSSING" De shell laat rekenkundige expressies toe om opgelost te worden onder zekere omstandigheden (zie de \fBlet\fP ingebouwde opdracht en \fBRekenkundige Expandering\fP). Oplossing wordt gedaan in lange hele getallen {#long integers#} zonder test op overloop, alhoewel delen door 0 gevangen wordt en gemerkt als fout. De volgende lijst van operators wordt gegroept in niveaus van gelijke voorrang operators. De niveaus worden opgesomd in volgorde van aflopende voorrang. .PP .PD 0 .TP .B \- + enkele min en plus .TP .B ! ~ logische en bitsgewijze niet .TP .B ** machtsverheffen .TP .B * / % vermenigvuldigen, delen, rest .TP .B + \- optellen, aftrekken .TP .B << >> links en rechts bitsgewijze verschuivingen .TP .B <= >= < > vergelijking .TP .B == != gelijkheid en ongelijkheid .TP .B & bitsgewijze EN .TP .B ^ bitsgewijze uitsluitende OF {#excl.#} .TP .B | bitsgewijze OF .TP .B && logische EN .TP .B || logische OF .TP .B \fIexpr\fP?\fIexpr\fP:\fIexpr\fP voorwaardelijke beoordeling .TP .B = *= /= %= += \-= <<= >>= &= ^= |= toekenning .PD .PP Shell's variabelen worden toegestaan als operanden; grootheid expandering wordt uitgevoerd vóór de expressie wordt opgelost. De waarde van een grootheid wordt omgezet naar een lang heel getal binnen een expressie. Een shell variabele hoeft zijn heel-getal eigenschap niet aan te hebben staan om gebruikt te worden in een expressie. .PP Constanten {#constants#} met een voorlopende 0 worden al octale nummers geïnterpreteerd. Een voorlopende 0x of 0X betekend hexadecimaal. Verder hebben getallen de vorm [\fIbasis#\fP]n, waar \fIbasis\fP een decimaal getal groter dan 1 en kleiner dan 65 is, de rekenkundige basis voorstellend, en \fIn\fP is een nummer in die basis. Als \fIbasis\fP wordt weggelaten wordt 10 aangenomen. De cijfers groter dan 9 worden voorgesteld door de kleine letters, hoofdletters, _, en @, in die volgorde. Als \fIbasis\fP minder dan of gelijk is aan 36 mogen kleine en hoofdletters uitwisselbaar worden gebruikt om cijfers tussen 10 en 35 voor te stellen. .PP Operatoren worden beoordeeld in volgorde van voorrang. Sub-expressies in haakjes worden eerst opgelost en mogen de bovenstaande voorrangsregel opzij zetten. .SH "VOORWAARDELIJKE UITDRUKKINGEN" Voorwaardelijke expressies worden gebruikt bij de \fB[[\fP gecompileerde opdracht en de \fBtest\fP en \fB[\fP ingebouwde opdrachten om een bestand eigenschap te testen en string en rekenkundige vergelijkingen uit te voeren. Expressies worden gevormd door de volgende enkele of binaire zaken. Als enig \fIbestand\fP argument voor één van de zaken van de vorm /dev/fd/\fIn\fP is, dan wordt bestand indicator \fIn\fP getest. .sp 1 .PD 0 .TP .B \-a \fIbestand\fP Waar als \fIbestand\fP bestaat. .TP .B \-b \fIbestand\fP Waar als \fIbestand\fP bestaat en een blok speciaal bestand is. .TP .B \-c \fIbestand\fP Waar als \fIbestand\fP bestaat en een karakter bijzonder bestand is. .TP .B \-d \fIbestand\fP Waar als \fIbestand\fP bestaat en een directorie is. .TP .B \-e \fIbestand\fP Waar als \fIbestand\fP bestaat .TP .B \-f \fIbestand\fP Waar als \fIbestand\fP bestaat en een normaal bestand is. .TP .B \-g \fIbestand\fP Waar als \fIbestand\fP bestaat en zet-groep-id is. .TP .B \-h \fIbestand\fP Waar als \fIbestand\fP bestaat en een symbolische koppeling is. .TP .B \-k \fIbestand\fP Waar als \fIbestand\fP bestaat en zijn ``sticky'' bit gezet is. .TP .B \-p \fIbestand\fP Waar als \fIbestand\fP bestaat en een benoemde pijp is (FIFO). .TP .B \-r \fIbestand\fP Waar als \fIbestand\fP bestaat en leesbaar is. .TP .B \-s \fIbestand\fP Waar als \fIbestand\fP bestaat en een grootte groter dan nul heeft. .TP .B \-t \fIbi\fP Waar als bestand indicator .I bi open is en naar een terminal {#terminal#} verwijst. .TP .B \-u \fIbestand\fP Waar als \fIbestand\fP bestaat en zijn zet-gebruiker-id is gezet. .TP .B \-w \fIbestand\fP Waar als \fIbestand\fP bestaat en schrijfbaar is. .TP .B \-x \fIbestand\fP Waar als \fIbestand\fP bestaat en uitvoerbaar is. .TP .B \-O \fIbestand\fP Waar als \fIbestand\fP bestaat en in bezit is van het geldende gebruiker id. .TP .B \-G \fIbestand\fP Waar als \fIbestand\fP bestaat en in bezit is van het geldende groep id. .TP .B \-L \fIbestand\fP Waar als \fIbestand\fP bestaat en een symbolische koppeling is. .TP .B \-S \fIbestand\fP Waar als \fIbestand\fP bestaat en een socket is. .TP .B \-N \fIbestand\fP Waar als \fIbestand\fP bestaat en veranderd is sinds het laatst gelezen werd. .TP \fIbestand1\fP \-\fBnt\fP \fIbestand2\fP Waar als \fIbestand1\fP nieuwer (volgens aanpassing {#modification#} datum) dan \fIbestand2\fP. .TP \fIbestand1\fP \-\fBot\fP \fIbestand2\fP Waar als \fIbestand1\fP ouder dan \fIbestand2\fP is. .TP \fIbestand1\fP \fB\-ef\fP \fIbestand2\fP Waar als \fIbestand1\fP en \fIbestand2\fP hetzelfde apparaat en inodenummer hebben. .TP .B \-o \fIoptienaam\fP Waar als shell optie .I optienaam aan status. Zie de lijst van opties onder de beschrijving van de .B \-o optie voor de .B set ingebouwde onder. .TP .B \-z \fIstring\fP Waar als de lengte van \fIstring\fP nul is. .TP .B \-n \fIstring\fP .TP \fIstring\fP Waar als de lengte van .I string ongelijk nul is. .TP \fIstring1\fP \fB==\fP \fIstring2\fP Waar als de strings gelijk zijn. \fB=\fP mag gebruikt worden in plaats van \fB==\fP. .TP \fIstring1\fP \fB!=\fP \fIstring2\fP Waar als de strings niet gelijk zijn. .TP \fIstring1\fP \fB<\fP \fIstring2\fP Waar als \fIstring1\fP sorteert vóór \fIstring2\fP volgens het woordenboek van de huidige localiteit. .TP \fIstring1\fP \fB>\fP \fIstring2\fP Waar als \fIstring1\fP sorteert na \fIstring2\fP volgens het woordenboek van de huidige localiteit. .TP .I \fIarg1\fP \fBOP\fP \fIarg2\fP .SM .B OP is één van .BR \-eq , .BR \-ne , .BR \-lt , .BR \-le , .BR \-gt , of .BR \-ge . Deze rekenkundige binaire operators geven waar terug als \fIarg1\fP respectievelijk gelijk is aan {#\-eq#}, niet gelijk is aan {#\-ne#}, minder dan {#\-lt#}, minder dan of gelijk aan {#\-le#}, groter dan {#\-gt#}, of groter dan of gelijk aan {#\-ge#} \fIarg2\fP. .I Arg1 en .I arg2 mogen positief of negatieve hele getallen zijn. .PD .SH "SIMPELE OPDRACHT VERGROTING" Wanneer een simpele opdracht wordt uitgevoerd doet de shell de volgende expanderingen, toekenningen en omleidingen, van links naar rechts. .IP 1. Het woord dat de verwerker aanmerkt voor variabele toekenningen (zij die voorafgaan aan de opdracht naam) en omleidingen worden bewaard om later verwerkt te worden. .IP 2. De woorden die niet variabele toekenningen of omleidingen zijn worden geëxpandeerd. Als enig woord overblijft na expandering, wordt het eerste woord genomen als de naam van de opdracht en de overblijvende woorden worden argumenten. .IP 3. Omleidingen worden uitgevoerd zoals boven onder .SM .BR OMLEIDEN " beschreven." .IP 4. De tekst na het \fB=\fP teken in elke variabele toekenning ondergaat tilde expandering, grootheid expandering, opdracht substitutie, rekenkundige expandering, en citering verwijdering vóór te worden toegekend aan de variabele. .PP .\"=====================[schelp->shell,enz.]================================ Als geen opdracht naam gevonden wordt beïnvloeden variabele toekenningen de huidige schelp omgeving. Anders worden de variabelen bij de omgeving van de uitvoerende opdracht gevoegd en beïnvloeden ze de huidige shell omgeving niet. Als enige van de toekenningen probeert een waarde toe te kennen aan een alleen-lezen variabele treedt een fout op, en de opdracht eindigt met een ongelijk-nul status. .PP Als geen opdracht naam resulteert worden omleidingen gedaan, maar die beïnvloeden de huidige shell omgeving niet. Een omleiding-fout zorgt dat de opdracht met een ongelijk-nul status eindigt. .PP Als er een opdracht naam overblijft na expandering gaat uitvoering verder zoals onder beschreven. Anders eindigt de opdracht. Als één van de vergrotingen een opdracht substitutie bevat is de einde status van de opdracht de einde status van de laatste uitgevoerde opdracht substitutie. Als er geen opdracht substituties waren eindigt de opdracht met een nul status. .SH "OPDRACHT UITVOERING" Nadat een opdracht is gesplitst in woorden, worden de volgende acties ondernomen als het resulteert in een simpele opdracht en een optionele lijst argumenten. .PP Als de opdracht naam geen slashes bevat probeert de shell het te vinden. Als er een shell functie met die naam bestaat, wordt die functie aangeroepen zoals beschreven boven in .SM .BR FUNCTIES . Als de naam niet overeenkomt met een functie zoekt de shell in de lijst ingebouwden. Als een overeenkomst is gevonden wordt die ingebouwde aangeroepen. .PP Als de naam nóg de naam van een shell functie, nóg de naam van een ingebouwde is, en geen slashes bevat zoekt .B bash elk element van .SM .B PATH voor een directorie die een uitvoerbaar bestand met die naam bevat. .B Bash gebruikt een hash tabel om de volle bestand namen te onthouden van het uitvoerbare bestand (zie .B hash onder .SM .B "SHELL INGEBOUWDE OPDRACHTEN" onder). Een volledig doorzoeken van de directories in .SM .B PATH wordt alleen gedaan als de opdracht niet gevonden wordt in de hash tabel. Als het zoeken faalt, drukt de shell een fout bericht af en keert terug met einde status 127. .PP Als het zoeken slaagt, of als de opdracht naam één of meer slashes bevat voert de shell het benoemde programma uit in een afzonderlijke uitvoering omgeving. Argument 0 wordt gezet naar de gegeven naam, en de overblijvende argumenten voor de opdracht worden gezet naar de gegeven argumenten, als aanwezig. .PP Als deze uitvoering faalt omdat het bestand in niet uitvoerbare vorm is, en het bestand geen map is, wordt aangenomen dat het een \fIshell script\fI is; een bestand dat shell opdrachten bevat. Een sub-shell wordt gejongd om het uit te voeren. Deze sub-shell herinitialiseerd zichzelf, zodat het effect is alsof een nieuwe shell wordt aangeroepen om het script af te handelen, met uitzondering dat herinnerde plaatsen van opdrachten worden herinnerd door de ouder (zie .B hash onder bij .SM \fBSHELL INGEBOUWDE OPDRACHTEN\fP) worden behouden door het kind. .PP Als het programma een bestand is dat begint met .BR #! , specificeert de rest van de regel een interpreteerder voor het programma. De shell voert de opgegeven interpreteerder uit op systemen die deze vorm niet zelf afhandelen. De argumenten voor de interpreteerder bestaan uit een enkel optioneel argument, volgend op de interpreteerder naam op de eerste regel van het programma, gevolgd door de naam van het programma, gevolgd door de opdracht argumenten, als aanwezig. .SH OPDRACHT UITVOERING OMGEVING De shell heeft een \fIuitvoering omgeving\fP, die bestaat uit het volgende: .sp 1 .IP \(bu open bestanden geërfd door de shell bij aanroepen, aangepast door omleidingen geleverd door de \fBexec\fP ingebouwde .IP \(bu de huidige werk directorie zoals gezet door \fBcd\fP, \fBpushd\fP, of \fBpopd\fP, of geërfd door de schelp bij aanroepen .IP \(bu het bestand maak masker zoals gezet door \fBumask\fP of geërfd van de shell's ouder .IP \(bu huidige `traps' {vallen/valkuilen} gezet door \fBtrap\fP .IP \(bu shell grootheden die gezet zijn door variabele toekenning of met \fBset\fP of geërfd van de shell's ouder in de omgeving .IP \(bu shell functies gedefinieerd gedurende uitvoering of geërfd van de shell's ouder in de omgeving .IP \(bu opties aangezet bij aanroepen (òf wegens standaard gedrag, òf met opdrachtregel argumenten) of door \fBset\fP gezet. .IP \(bu opties aangezet door \fBshopt\fP .IP \(bu shell aliasses bepaalt met \fBalias\fP .IP \(bu verschillende proces ID's, onder andere die van achtergrond taken, de waarde van \fB$$\fP, en de waarde van \fB$PPID\fP .PP Wanneer een simpele opdracht anders dan een ingebouwde of shell functie wordt uitgevoerd, wordt het uitgevoerd in een aparte uitvoerings omgeving die bestaat uit het volgende. Tenzij anders vermeld worden de waardes geërfd van de shell. .sp 1 .IP \(bu de shell's open bestanden, plus enige aanpassingen en aanvullingen opgegeven door omleidingen voor de opdracht .IP \(bu de huidige werk directorie .IP \(bu het bestand maak mode masker .IP \(bu shell variabelen aangemerkt voor exportatie, samen met variabelen geëxporteerd voor de opdracht, doorgegeven in de omgeving .IP \(bu `traps' afgevangen door de shell, worden reset tot de waardes die de shell erfde van zijn ouder, en traps genegeerd door de shell worden genegeerd .PP Een opdracht aangeroepen in deze aparte omgeving kan niet de shell's uitvoering omgeving beïnvloeden. .PP Opdracht substitutie en asynchrone opdrachten worden aangeroepen in een sub-shell omgeving die een kloon is van de shell omgeving, behalve dat traps gevangen door de shell worden reset tot de waardes die de shell erfde van zijn ouder bij aanroepen. Ingebouwde opdrachten die worden aangeroepen als onderdeel van een pijplijn worden ook uitgevoerd in een sub-shell omgeving. Veranderingen gemaakt voor de sub-shell omgeving kunnen de shell's uitvoering omgeving niet beïnvloeden. .SH OMGEVING Wanneer een programma wordt aangeroepen, wordt het een tabel met strings gegeven, bekend onder de naam .IR omgeving . Dit is een lijst van \fInaam\fP\-\fIwaarde\fP paren, in de vorm .IR "naam\fR=\fPwaarde" . .PP De shell laat u toe deze omgeving te manipuleren op verschillende manieren. Bij aanroepen zoekt de shell zijn eigen omgeving en maakt een grootheid voor elke gevonden naam, het automatisch aanmerkend voor .I exportering naar kind processen. Uitgevoerde opdrachten erven deze omgeving. De .B export en .B declare \-x opdrachten laten toe dat grootheden en functies aan de omgeving kunnen worden toegevoegd of eruit worden geschrapt. Als de waarde van een grootheid in de omgeving wordt aangepast wordt de nieuwe waarde onderdeel van de omgeving, de oude waarde vervangend. De omgeving die geërfd wordt door elke uitvoerende opdracht {programma} bestaat uit de initiële omgeving van de shell, waarvan de waardes kunnen zijn aangepast in de shell, zonder de paren die zijn verwijderd met de. .B unset opdracht, met mogelijke aanvullingen met de .B export en .B declare \-x opdrachten. .PP De omgeving voor een .I simpele opdracht of functie kan tijdelijk aangevuld worden door een grootheid toekenning ervoor te zetten, zoals beschreven bij .SM .BR GROOTHEDEN . Deze toekennings commando's beïnvloeden alleen de omgeving die door die opdracht wordt gezien. .PP Als de .B \-k optie is gezet (zie de .B set ingebouwde opdracht onder), dan worden .I alle grootheid-toekeningen in de omgeving van een opdracht geplaatst, niet alleen die waaraan het aan de opdracht voorafgaat. .PP Wanneer .B bash een externe opdracht aanroept wordt de variabele .B _ gezet naar de volledige naam van de opdracht, en wordt die variabele doorgeven aan die opdracht zijn omgeving. .SH "EIND WAARDE" Voor gebruik door de shell wordt aangenomen dat een opdracht die eindigt met een nul beeindigings-status geslaagd is. Een beeindigings-status van nul geeft succes aan. Een niet-nul eindwaarde geeft falen aan. Wanneer een opdracht eindigt met een fataal signaal gebruikt \fBbash\fP de waarde 128+\Bsignaal\fP als de eindwaarde. .PP Als een opdracht niet werd gevonden, geeft het kind-proces dat gemaakt werd om het uit te voeren 127 terug. Als een opdracht wel werd gevonden maar niet uitvoerbaar is, is de terugkeer-waarde 126. .PP Als een opdracht faalt door een fout tijdens het expanderen of het omleiden is de eindwaarde groten dan nul. .PP Shell ingebouwde opdrachten geven een waarda van 0 (\fIwaar\fP) als succes, en niet-nul (\fIfout\fP) als een fout optreedt tijdens uitvoering. Alle ingebouwden keren terug met 2 om verkeerd gebruik aan te geven. .PP \fBBash\fP zelf keert terug met de eindwaarde van de laatst uitgevoerde opdracht, tenzij er een spellingsfout is, in welk geval het eindigt met een niet-nul terugkeerwaarde. Zie ook de \fBexit\fP ingebouwde opdracht onder. .SH SIGNALS Als \fBbash\fp interactief is negeert het in de afwezigheid van enige vallen {traps} .SM .B SIGTERM {zodat \fBkill 0\fP de interactieve schell niet vermoord), en .SM .B SIGINT wordt gevangen en afgehandeld (zodat de \fBwait\fP ingebouwde onderbreekbaar is). In elk geval negeert \fBbash\fP .SM .BR SIGQUIT . Als taak controle werkt, dan negeert .B bash .SM .BR SIGTTIN , .SM .BR SIGTTOU , en .SM .BR SIGTSTP . .PP Synchrone taken die zijn gestart door \fBbash\fP hebben signaal behandelaars die gezet zijn naar waardes die zijn geërfd door de shell van zijn ouder. Wanneer taak controle niet werkt negeren asynchrone opdrachten .SM .B SIGINT en .SM .B SIGQUIT ook. Opdrachten die draaien tengevolgde van opdracht-substitutie negeren de toetsenbord-gegenereerde taak-controle signalen. .SM .BR SIGTTIN , .SM .BR SIGTTOU , en .SM .BR SIGTSTP . .PP De shell eindigt standaard bij ontvangen van een .SM .BR SIGHUP . Vóór eindigen zendt het een .SM .B SIGHUP naar alle taken, draaiende en gestopte. Gestopte taken wordt een .SM .B SIGCONT gezonden om er zeker van te zijn dat ze de .SM .BR SIGHUP " ontvangen." Om de shell te behoeden voor het zenden van een signaal naar een bepaalde taak moet het verwijderd worden van de taken-tabel met de .B disown ingebouwde (zie .SM .B "SHELL INGEBOUWDE OPDRACHTEN" onder) of gemarkeerd om geen .SM .B SIGHUP te ontvangen met .BR "disown \-h" . .PP Als de .B huponexit shell optie gezet werdt met .BR shopt , dan zendt .B bash een .SM .B SIGHUP naar alle taken wanneer een interactieve login shell eindigt .PP Als \fBbash\fP een signaal ontvangt waarvoor een val {trap} is gezet, terwijl het wacht op het einde van de opdracht, zal de val niet worden uitgevoerd totdat de opdracht eindigt. Als \fBbash\fP wacht op een asynchrone opdracht met de \fBwait\fP ingebouwde, dan zal het ontvangen van een signaal waarvoor een val werd gezet zorgen dat de \fBwait\fP ingebouwde onmiddelijk terugkeert met een terugkeer-waarde groter dan 128, onmiddelijk nadat de val werd uitgevoerd. .\" MARK---MARK ----vertaalt-tot-hier...---- .SH "JOB CONTROL" .I Job control refers to the ability to selectively stop (\fIsuspend\fP) the execution of processes and continue (\fIresume\fP) their execution at a later point. A user typically employs this facility via an interactive interface supplied jointly by the system's terminal driver and .BR bash . .PP The shell associates a .I job with each pipeline. It keeps a table of currently executing jobs, which may be listed with the .B jobs command. When .B bash starts a job asynchronously (in the .IR background ), it prints a line that looks like: .RS .PP [1] 25647 .RE .PP indicating that this job is job number 1 and that the process ID of the last process in the pipeline associated with this job is 25647. All of the processes in a single pipeline are members of the same job. .B Bash uses the .I job abstraction as the basis for job control. .PP To facilitate the implementation of the user interface to job control, the system maintains the notion of a \fIcurrent terminal process group ID\fP. Members of this process group (processes whose process group ID is equal to the current terminal process group ID) receive keyboard-generated signals such as .SM .BR SIGINT . These processes are said to be in the .IR foreground . .I Background processes are those whose process group ID differs from the terminal's; such processes are immune to keyboard-generated signals. Only foreground processes are allowed to read from or write to the terminal. Background processes which attempt to read from (write to) the terminal are sent a .SM .B SIGTTIN (SIGTTOU) signal by the terminal driver, which, unless caught, suspends the process. .PP If the operating system on which .B bash is running supports job control, .B bash allows you to use it. Typing the .I suspend character (typically .BR ^Z , Control-Z) while a process is running causes that process to be stopped and returns you to .BR bash . Typing the .I "delayed suspend" character (typically .BR ^Y , Control-Y) causes the process to be stopped when it attempts to read input from the terminal, and control to be returned to .BR bash . The user may then manipulate the state of this job, using the .B bg command to continue it in the background, the .B fg command to continue it in the foreground, or the .B kill command to kill it. A \fB^Z\fP takes effect immediately, and has the additional side effect of causing pending output and typeahead to be discarded. .PP There are a number of ways to refer to a job in the shell. The character .B % introduces a job name. Job number .I n may be referred to as .BR %n . A job may also be referred to using a prefix of the name used to start it, or using a substring that appears in its command line. For example, .B %ce refers to a stopped .B ce job. If a prefix matches more than one job, .B bash reports an error. Using .BR %?ce , on the other hand, refers to any job containing the string .B ce in its command line. If the substring matches more than one job, .B bash reports an error. The symbols .B %% and .B %+ refer to the shell's notion of the .IR "current job" , which is the last job stopped while it was in the foreground or started in the background. The .I "previous job" may be referenced using .BR %\- . In output pertaining to jobs (e.g., the output of the .B jobs command), the current job is always flagged with a .BR + , and the previous job with a .BR \- . .PP Simply naming a job can be used to bring it into the foreground: .B %1 is a synonym for \fB``fg %1''\fP, bringing job 1 from the background into the foreground. Similarly, .B ``%1 &'' resumes job 1 in the background, equivalent to \fB``bg %1''\fP. .PP The shell learns immediately whenever a job changes state. Normally, .B bash waits until it is about to print a prompt before reporting changes in a job's status so as to not interrupt any other output. If the .B \-b option to the .B set builtin command is enabled, .B bash reports such changes immediately. .PP If an attempt to exit .B bash is made while jobs are stopped, the shell prints a warning message. The .B jobs command may then be used to inspect their status. If a second attempt to exit is made without an intervening command, the shell does not print another warning, and the stopped jobs are terminated. .SH PROMPTING When executing interactively, .B bash displays the primary prompt .SM .B PS1 when it is ready to read a command, and the secondary prompt .SM .B PS2 when it needs more input to complete a command. .B Bash allows these prompt strings to be customized by inserting a number of backslash-escaped special characters that are decoded as follows: .RS .PD 0 .TP .B \ea an ASCII bell character (07) .TP .B \ed the date in "Weekday Month Date" format (e.g., "Tue May 26") .TP .B \ee an ASCII escape character (033) .TP .B \eh the hostname up to the first `.' .TP .B \eH the hostname .TP .B \en newline .TP .B \er carriage return .TP .B \es the name of the shell, the basename of .B $0 (the portion following the final slash) .TP .B \et the current time in 24-hour HH:MM:SS format .TP .B \eT the current time in 12-hour HH:MM:SS format .TP .B \e@ the current time in 12-hour am/pm format .TP .B \eu the username of the current user .TP .B \ev the version of \fBbash\fP (e.g., 2.00) .TP .B \eV the release of \fBbash\fP, version + patchlevel (e.g., 2.00.0) .TP .B \ew the current working directory .TP .B \eW the basename of the current working directory .TP .B \e! the history number of this command .TP .B \e# the command number of this command .TP .B \e$ if the effective UID is 0, a .BR # , otherwise a .B $ .TP .B \e\fInnn\fP the character corresponding to the octal number \fInnn\fP .TP .B \e\e a backslash .TP .B \e[ begin a sequence of non-printing characters, which could be used to embed a terminal control sequence into the prompt .TP .B \e] end a sequence of non-printing characters .PD .RE .PP The command number and the history number are usually different: the history number of a command is its position in the history list, which may include commands restored from the history file (see .SM .B HISTORY below), while the command number is the position in the sequence of commands executed during the current shell session. After the string is decoded, it is expanded via parameter expansion, command substitution, arithmetic expansion, string expansion, and quote removal, subject to the value of the .B promptvars shell option (see the description of the .B shopt command under .SM .B "SHELL BUILTIN COMMANDS" below). .SH READLINE This is the library that handles reading input when using an interactive shell, unless the .B \-\-noediting option is given at shell invocation. By default, the line editing commands are similar to those of emacs. A vi-style line editing interface is also available. To turn off line editing after the shell is running, use the .B +o emacs or .B +o vi options to the .B set builtin (see .SM .B SHELL BUILTIN COMMANDS below). .SS "Readline Notation" .PP In this section, the emacs-style notation is used to denote keystrokes. Control keys are denoted by C\-\fIkey\fR, e.g., C\-n means Control\-N. Similarly, .I meta keys are denoted by M\-\fIkey\fR, so M\-x means Meta\-X. (On keyboards without a .I meta key, M\-\fIx\fP means ESC \fIx\fP, i.e., press the Escape key then the .I x key. This makes ESC the \fImeta prefix\fP. The combination M\-C\-\fIx\fP means ESC\-Control\-\fIx\fP, or press the Escape key then hold the Control key while pressing the .I x key.) .PP Readline commands may be given numeric .IR arguments , which normally act as a repeat count. Sometimes, however, it is the sign of the argument that is significant. Passing a negative argument to a command that acts in the forward direction (e.g., \fBkill\-line\fP) causes that command to act in a backward direction. Commands whose behavior with arguments deviates from this are noted below. .PP When a command is described as \fIkilling\fP text, the text deleted is saved for possible future retrieval (\fIyanking\fP). The killed text is saved in a \fIkill ring\fP. Consecutive kills cause the text to be accumulated into one unit, which can be yanked all at once. Commands which do not kill text separate the chunks of text on the kill ring. .SS "Readline Initialization" .PP Readline is customized by putting commands in an initialization file (the \fIinputrc\fP file). The name of this file is taken from the value of the .SM .B INPUTRC variable. If that variable is unset, the default is .IR ~/.inputrc . When a program which uses the readline library starts up, the initialization file is read, and the key bindings and variables are set. There are only a few basic constructs allowed in the readline initialization file. Blank lines are ignored. Lines beginning with a \fB#\fP are comments. Lines beginning with a \fB$\fP indicate conditional constructs. Other lines denote key bindings and variable settings. .PP The default key-bindings may be changed with an .I inputrc file. Other programs that use this library may add their own commands and bindings. .PP For example, placing .RS .PP M\-Control\-u: universal\-argument .RE or .RS C\-Meta\-u: universal\-argument .RE into the .I inputrc would make M\-C\-u execute the readline command .IR universal\-argument . .PP The following symbolic character names are recognized: .IR RUBOUT , .IR DEL , .IR ESC , .IR LFD , .IR NEWLINE , .IR RET , .IR RETURN , .IR SPC , .IR SPACE , and .IR TAB . In addition to command names, readline allows keys to be bound to a string that is inserted when the key is pressed (a \fImacro\fP). .SS "Readline Key Bindings" .PP The syntax for controlling key bindings in the .I inputrc file is simple. All that is required is the name of the command or the text of a macro and a key sequence to which it should be bound. The name may be specified in one of two ways: as a symbolic key name, possibly with \fIMeta\-\fP or \fIControl\-\fP prefixes, or as a key sequence. When using the form \fBkeyname\fP:\^\fIfunction\-name\fP or \fImacro\fP, .I keyname is the name of a key spelled out in English. For example: .sp .RS Control-u: universal\-argument .br Meta-Rubout: backward-kill-word .br Control-o: "> output" .RE .LP In the above example, .I C\-u is bound to the function .BR universal\-argument , .I M\-DEL is bound to the function .BR backward\-kill\-word , and .I C\-o is bound to run the macro expressed on the right hand side (that is, to insert the text .I "> output" into the line). .PP In the second form, \fB"keyseq"\fP:\^\fIfunction\-name\fP or \fImacro\fP, .B keyseq differs from .B keyname above in that strings denoting an entire key sequence may be specified by placing the sequence within double quotes. Some GNU Emacs style key escapes can be used, as in the following example. .sp .RS "\eC\-u": universal\-argument .br "\eC\-x\eC\-r": re\-read\-init\-file .br "\ee[11~": "Function Key 1" .RE .PP In this example, .I C\-u is again bound to the function .BR universal\-argument . .I "C\-x C\-r" is bound to the function .BR re\-read\-init\-file , and .I "ESC [ 1 1 ~" is bound to insert the text .BR "Function Key 1" . The full set of GNU Emacs style escape sequences is .RS .PD 0 .TP .B \eC\- control prefix .TP .B \eM\- meta prefix .TP .B \ee an escape character .TP .B \e\e backslash .TP .B \e" literal " .TP .B \e' literal ' .RE .PD .PP In addition to the GNU Emacs style escape sequences, a second set of backslash escapes is available: .RS .PD 0 .TP .B \ea alert (bell) .TP .B \eb backspace .TP .B \ed delete .TP .B \ef form feed .TP .B \en newline .TP .B \er carriage return .TP .B \et horizontal tab .TP .B \ev vertical tab .TP .B \e\fInnn\fP the character whose ASCII code is the octal value \fInnn\fP (one to three digits) .TP .B \ex\fInnn\fP the character whose ASCII code is the hexadecimal value \fInnn\fP (one to three digits) .RE .PD .PP When entering the text of a macro, single or double quotes must be used to indicate a macro definition. Unquoted text is assumed to be a function name. In the macro body, the backslash escapes described above are expanded. Backslash will quote any other character in the macro text, including " and '. .PP .B Bash allows the current readline key bindings to be displayed or modified with the .B bind builtin command. The editing mode may be switched during interactive use by using the .B \-o option to the .B set builtin command (see .SM .B SHELL BUILTIN COMMANDS below). .SS "Readline Variables" .PP Readline has variables that can be used to further customize its behavior. A variable may be set in the .I inputrc file with a statement of the form .RS .PP \fBset\fP \fIvariable\-name\fP \fIvalue\fP .RE .PP Except where noted, readline variables can take the values .B On or .BR Off . The variables and their default values are: .PP .PD 0 .TP .B bell\-style (audible) Controls what happens when readline wants to ring the terminal bell. 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 comment\-begin (``#'') The string that is inserted when the .B readline .B insert\-comment command is executed. This command is bound to .B M\-# in emacs mode and to .B # in vi command mode. .TP .B completion\-ignore\-case (Off) If set to \fBOn\fP, readline performs filename matching and completion in a case\-insensitive fashion. .TP .B completion\-query\-items (100) This determines when the user is queried about viewing the number of possible completions generated by the \fBpossible\-completions\fP command. It may be set to any integer value greater than or equal to zero. If the number of possible completions is greater than or equal to the value of this variable, the user is asked whether or not he wishes to view them; otherwise they are simply listed on the terminal. .TP .B convert\-meta (On) If set to \fBOn\fP, readline will convert characters with the eighth bit set to an ASCII key sequence by stripping the eighth bit and prepending an escape character (in effect, using escape as the \fImeta prefix\fP). .TP .B disable\-completion (Off) If set to \fBOn\fP, readline will inhibit word completion. Completion characters will be inserted into the line as if they had been directorieped to \fBself-insert\fP. .TP .B editing\-mode (emacs) Controls whether readline begins with a set of key bindings similar to \fIemacs\fP or \fIvi\fP. .B editing\-mode can be set to either .B emacs or .BR vi . .TP .B enable\-keypad (Off) When set to \fBOn\fP, readline will try to enable the application keypad when it is called. Some systems need this to enable the arrow keys. .TP .B expand\-tilde (Off) If set to \fBon\fP, tilde expansion is performed when readline attempts word completion. .TP .B horizontal\-scroll\-mode (Off) When set to \fBOn\fP, makes readline use a single line for display, scrolling the input horizontally on a single screen line when it becomes longer than the screen width rather than wrapping to a new line. .TP .B input\-meta (Off) If set to \fBOn\fP, readline will enable eight-bit input (that is, it will not strip the high bit from the characters it reads), regardless of what the terminal claims it can support. The name .B meta\-flag is a synonym for this variable. .TP .B isearch\-terminators (``C\-[C\-J'') The string of characters that should terminate an incremental search without subsequently executing the character as a command. If this variable has not been given a value, the characters \fIESC\fP and \fIC\-J\fP will terminate an incremental search. .TP .B keydir (emacs) Set the current readline keydirectorie. The set of valid keydir names is \fIemacs, emacs\-standard, emacs\-meta, emacs\-ctlx, vi, vi\-command\fP, and .IR vi\-insert . \fIvi\fP is equivalent to \fIvi\-command\fP; \fIemacs\fP is equivalent to \fIemacs\-standard\fP. The default value is .IR emacs ; the value of .B editing\-mode also affects the default keydirectorie. .TP .B mark\-directories (On) If set to \fBOn\fP, completed directory names have a slash appended. .TP .B mark\-modified\-lines (Off) If set to \fBOn\fP, history lines that have been modified are displayed with a preceding asterisk (\fB*\fP). .TP .B output\-meta (Off) If set to \fBOn\fP, readline will display characters with the eighth bit set directly rather than as a meta-prefixed escape sequence. .TP .B print\-completions\-horizontally (Off) If set to \fBOn\fP, readline will display completions with matches sorted horizontally in alphabetical order, rather than down the screen. .TP .B show\-all\-if\-ambiguous (Off) This alters the default behavior of the completion functions. If set to .BR on , words which have more than one possible completion cause the matches to be listed immediately instead of ringing the bell. .TP .B visible\-stats (Off) If set to \fBOn\fP, a character denoting a file's type as reported by \fIstat\fP(2) is appended to the filename when listing possible completions. .PD .SS "Readline Conditional Constructs" .PP Readline implements a facility similar in spirit to the conditional compilation features of the C preprocessor which allows key bindings and variable settings to be performed as the result of tests. There are four parser directives used. .IP \fB$if\fP The .B $if construct allows bindings to be made based on the editing mode, the terminal being used, or the application using readline. The text of the test extends to the end of the line; no characters are required to isolate it. .RS .IP \fBmode\fP The \fBmode=\fP form of the \fB$if\fP directive is used to test whether readline is in emacs or vi mode. This may be used in conjunction with the \fBset keydirectorie\fP command, for instance, to set bindings in the \fIemacs\-standard\fP and \fIemacs\-ctlx\fP keydirectories only if readline is starting out in emacs mode. .IP \fBterm\fP The \fBterm=\fP form may be used to include terminal-specific key bindings, perhaps to bind the key sequences output by the terminal's function keys. The word on the right side of the .B = is tested against the both full name of the terminal and the portion of the terminal name before the first \fB\-\fP. This allows .I sun to match both .I sun and .IR sun\-cmd , for instance. .IP \fBapplication\fP The \fBapplication\fP construct is used to include application-specific settings. Each program using the readline library sets the \fIapplication name\fP, and an initialization file can test for a particular value. This could be used to bind key sequences to functions useful for a specific program. For instance, the following command adds a key sequence that quotes the current or previous word in Bash: .sp 1 .RS .nf \fB$if\fP Bash # Quote the current or previous word "\eC\-xq": "\eeb\e"\eef\e"" \fB$endif\fP .fi .RE .RE .IP \fB$endif\fP This command, as seen in the previous example, terminates an \fB$if\fP command. .IP \fB$else\fP Commands in this branch of the \fB$if\fP directive are executed if the test fails. .IP \fB$include\fP This directive takes a single filename as an argument and reads commands and bindings from that file. For example, the following directive would read \fI/etc/inputrc\fP: .sp 1 .RS .nf \fB$include\fP \^ \fI/etc/inputrc\fP .fi .RE .SS Searching .PP Readline provides commands for searching through the command history (see .SM .B HISTORY below) for lines containing a specified string. There are two search modes: .I incremental and .IR non-incremental . .PP Incremental searches begin before the user has finished typing the search string. As each character of the search string is typed, readline displays the next entry from the history matching the string typed so far. An incremental search requires only as many characters as needed to find the desired history entry. The characters present in the value of the \fIisearch-terminators\fP variable are used to terminate an incremental search. If that variable has not been assigned a value the Escape and Control-J characters will terminate an incremental search. Control-G will abort an incremental search and restore the original line. When the search is terminated, the history entry containing the search string becomes the current line. To find other matching entries in the history list, type Control-S or Control-R as appropriate. This will search backward or forward in the history for the next entry matching the search string typed so far. Any other key sequence bound to a readline command will terminate the search and execute that command. For instance, a \fInewline\fP will terminate the search and accept the line, thereby executing the command from the history list. .PP Non-incremental searches read the entire search string before starting to search for matching history lines. The search string may be typed by the user or be part of the contents of the current line. .SS "Readline Command Names" .PP The following is a list of the names of the commands and the default key sequences to which they are bound. Command names without an accompanying key sequence are unbound by default. .SS Commands for Moving .PP .PD 0 .TP .B beginning\-of\-line (C\-a) Move to the start of the current line. .TP .B end\-of\-line (C\-e) Move to the end of the line. .TP .B forward\-char (C\-f) Move forward a character. .TP .B backward\-char (C\-b) Move back a character. .TP .B forward\-word (M\-f) Move forward to the end of the next word. Words are composed of alphanumeric characters (letters and digits). .TP .B backward\-word (M\-b) Move back to the start of this, or the previous, word. Words are composed of alphanumeric characters (letters and digits). .TP .B clear\-screen (C\-l) Clear the screen leaving the current line at the top of the screen. With an argument, refresh the current line without clearing the screen. .TP .B redraw\-current\-line Refresh the current line. .PD .SS Commands for Manipulating the History .PP .PD 0 .TP .B accept\-line (Newline, Return) Accept the line regardless of where the cursor is. If this line is non-empty, add it to the history list according to the state of the .SM .B HISTCONTROL variable. If the line is a modified history line, then restore the history line to its original state. .TP .B previous\-history (C\-p) Fetch the previous command from the history list, moving back in the list. .TP .B next\-history (C\-n) Fetch the next command from the history list, moving forward in the list. .TP .B beginning\-of\-history (M\-<) Move to the first line in the history. .TP .B end\-of\-history (M\->) Move to the end of the input history, i.e., the line currently being entered. .TP .B reverse\-search\-history (C\-r) Search backward starting at the current line and moving `up' through the history as necessary. This is an incremental search. .TP .B forward\-search\-history (C\-s) Search forward starting at the current line and moving `down' through the history as necessary. This is an incremental search. .TP .B non\-incremental\-reverse\-search\-history (M\-p) Search backward through the history starting at the current line using a non-incremental search for a string supplied by the user. .TP .B non\-incremental\-forward\-search\-history (M\-n) Search forward through the history using a non-incremental search for a string supplied by the user. .TP .B history\-search\-forward Search forward through the history for the string of characters between the start of the current line and the current cursor position (the \fIpoint\fP). This is a non-incremental search. .TP .B history\-search\-backward Search backward through the history for the string of characters between the start of the current line and the point. This is a non-incremental search. .TP .B yank\-nth\-arg (M\-C\-y) Insert the first argument to the previous command (usually the second word on the previous line) at point (the current cursor position). With an argument .IR n , 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. .TP .B yank\-last\-arg (M\-.\^, M\-_\^) Insert the last argument to the previous command (the last word of 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. .TP .B shell\-expand\-line (M\-C\-e) Expand the line as the shell does. This performs alias and history expansion as well as all of the shell word expansions. See .SM .B HISTORY EXPANSION below for a description of history expansion. .TP .B history\-expand\-line (M\-^) Perform history expansion on the current line. See .SM .B HISTORY EXPANSION below for a description of history expansion. .TP .B magic\-space Perform history expansion on the current line and insert a space. See .SM .B HISTORY EXPANSION below for a description of history expansion. .TP .B alias\-expand\-line Perform alias expansion on the current line. See .SM .B ALIASES above for a description of alias expansion. .TP .B history\-and\-alias\-expand\-line Perform history and alias expansion on the current line. .TP .B insert\-last\-argument (M\-.\^, M\-_\^) A synonym for \fByank\-last\-arg\fP. .TP .B operate\-and\-get\-next (C\-o) Accept the current line for execution and fetch the next line relative to the current line from the history for editing. Any argument is ignored. .PD .SS Commands for Changing Text .PP .PD 0 .TP .B delete\-char (C\-d) Delete the character under the cursor. If point is at the beginning of the line, there are no characters in the line, and the last character typed was not bound to \fBdelete\-char\fP, then return .SM .BR EOF . .TP .B backward\-delete\-char (Rubout) Delete the character behind the cursor. When given a numeric argument, save the deleted text on the kill ring. .TP .B forward\-backward\-delete\-char Delete the character under the cursor, unless the cursor is at the end of the line, in which case the character behind the cursor is deleted. By default, this is not bound to a key. .TP .B quoted\-insert (C\-q, C\-v) Add the next character typed to the line verbatim. This is how to insert characters like \fBC\-q\fP, for example. .TP .B tab\-insert (C\-v TAB) Insert a tab character. .TP .B self\-insert (a,\ b,\ A,\ 1,\ !,\ ...) Insert the character typed. .TP .B transpose\-chars (C\-t) Drag the character before point forward over the character at point. Point moves forward as well. If point is at the end of the line, then transpose the two characters before point. Negative arguments don't work. .TP .B transpose\-words (M\-t) Drag the word behind the cursor past the word in front of the cursor moving the cursor over that word as well. .TP .B upcase\-word (M\-u) Uppercase the current (or following) word. With a negative argument, uppercase the previous word, but do not move point. .TP .B downcase\-word (M\-l) Lowercase the current (or following) word. With a negative argument, lowercase the previous word, but do not move point. .TP .B capitalize\-word (M\-c) Capitalize the current (or following) word. With a negative argument, capitalize the previous word, but do not move point. .PD .SS Killing and Yanking .PP .PD 0 .TP .B kill\-line (C\-k) Kill the text from the current cursor position to the end of the line. .TP .B backward\-kill\-line (C\-x Rubout) Kill backward to the beginning of the line. .TP .B unix\-line\-discard (C\-u) Kill backward from point to the beginning of the line. The killed text is saved on the kill-ring. \" There is no real difference between this and backward-kill-line .TP .B kill\-whole\-line Kill all characters on the current line, no matter where the cursor is. .TP .B kill\-word (M\-d) Kill from the cursor to the end of the current word, or if between words, to the end of the next word. Word boundaries are the same as those used by \fBforward\-word\fP. .TP .B backward\-kill\-word (M\-Rubout) Kill the word behind the cursor. Word boundaries are the same as those used by \fBbackward\-word\fP. .TP .B unix\-word\-rubout (C\-w) Kill the word behind the cursor, using white space as a word boundary. The word boundaries are different from \fBbackward\-kill\-word\fP. .TP .B delete\-horizontal\-space (M\-\e) Delete all spaces and tabs around point. .TP .B kill\-region Kill the text between the point and \fImark\fP (saved cursor position). This text is referred to as the \fIregion\fP. .TP .B copy\-region\-as\-kill Copy the text in the region to the kill buffer. .TP .B copy\-backward\-word Copy the word before point to the kill buffer. The word boundaries are the same as \fBbackward\-word\fP. .TP .B copy\-forward\-word Copy the word following point to the kill buffer. The word boundaries are the same as \fBforward\-word\fP. .TP .B yank (C\-y) Yank the top of the kill ring into the buffer at the cursor. .TP .B yank\-pop (M\-y) Rotate the kill ring, and yank the new top. Only works following .B yank or .BR yank\-pop . .PD .SS Numeric Arguments .PP .PD 0 .TP .B digit\-argument (M\-0, M\-1, ..., M\-\-) Add this digit to the argument already accumulating, or start a new argument. M\-\- starts a negative argument. .TP .B universal\-argument This is another way to specify an argument. If this command is followed by one or more digits, optionally with a leading minus sign, those digits define the argument. If the command is followed by digits, executing .B universal\-argument again ends the numeric argument, but is otherwise ignored. As a special case, if this command is immediately followed by a character that is neither a digit or minus sign, the argument count for the next command is multiplied by four. The argument count is initially one, so executing this function the first time makes the argument count four, a second time makes the argument count sixteen, and so on. .PD .SS Completing .PP .PD 0 .TP .B complete (TAB) Attempt to perform completion on the text before point. .B Bash attempts completion treating the text as a variable (if the text begins with \fB$\fP), username (if the text begins with \fB~\fP), hostname (if the text begins with \fB@\fP), or command (including aliases and functions) in turn. If none of these produces a match, filename completion is attempted. .TP .B possible\-completions (M\-?) List the possible completions of the text before point. .TP .B insert\-completions (M\-*) Insert all completions of the text before point that would have been generated by \fBpossible\-completions\fP. .TP .B menu\-complete Similar to \fBcomplete\fP, but replaces the word to be completed with a single match from the list of possible completions. Repeated execution of \fBmenu\-complete\fP steps through the list of possible completions, inserting each match in turn. At the end of the list of completions, the bell is rung and the original text is restored. An argument of \fIn\fP moves \fIn\fP positions forward in the list of matches; a negative argument may be used to move backward through the list. This command is intended to be bound to \fBTAB\fP, but is unbound by default. .TP .B delete\-char\-or\-list Deletes the character under the cursor if not at the beginning or end of the line (like \fBdelete-char\fP). If at the end of the line, behaves identically to \fBpossible-completions\fP. This command is unbound by default. .TP .B complete\-filename (M\-/) Attempt filename completion on the text before point. .TP .B possible\-filename\-completions (C\-x /) List the possible completions of the text before point, treating it as a filename. .TP .B complete\-username (M\-~) Attempt completion on the text before point, treating it as a username. .TP .B possible\-username\-completions (C\-x ~) List the possible completions of the text before point, treating it as a username. .TP .B complete\-variable (M\-$) Attempt completion on the text before point, treating it as a shell variable. .TP .B possible\-variable\-completions (C\-x $) List the possible completions of the text before point, treating it as a shell variable. .TP .B complete\-hostname (M\-@) Attempt completion on the text before point, treating it as a hostname. .TP .B possible\-hostname\-completions (C\-x @) List the possible completions of the text before point, treating it as a hostname. .TP .B complete\-command (M\-!) Attempt completion on the text before point, treating it as a command name. Command completion attempts to match the text against aliases, reserved words, shell functions, shell builtins, and finally executable filenames, in that order. .TP .B possible\-command\-completions (C\-x !) List the possible completions of the text before point, treating it as a command name. .TP .B dynamic\-complete\-history (M\-TAB) Attempt completion on the text before point, comparing the text against lines from the history list for possible completion matches. .TP .B complete\-into\-braces (M\-{) Perform filename completion and return the list of possible completions enclosed within braces so the list is available to the shell (see .B Brace Expansion above). .PD .SS Keyboard Macros .PP .PD 0 .TP .B start\-kbd\-macro (C\-x (\^) Begin saving the characters typed into the current keyboard macro. .TP .B end\-kbd\-macro (C\-x )\^) Stop saving the characters typed into the current keyboard macro and store the definition. .TP .B call\-last\-kbd\-macro (C\-x e) Re-execute the last keyboard macro defined, by making the characters in the macro appear as if typed at the keyboard. .PD .SS Miscellaneous .PP .PD 0 .TP .B re\-read\-init\-file (C\-x C\-r) Read in the contents of the \fIinputrc\fP file, and incorporate any bindings or variable assignments found there. .TP .B abort (C\-g) Abort the current editing command and ring the terminal's bell (subject to the setting of .BR bell\-style ). .TP .B do\-uppercase\-version (M\-a, M\-b, M\-\fIx\fP, ...) If the metafied character \fIx\fP is lowercase, run the command that is bound to the corresponding uppercase character. .TP .B prefix\-meta (ESC) Metafy the next character typed. .SM .B ESC .B f is equivalent to .BR Meta\-f . .TP .B undo (C\-_, C\-x C\-u) Incremental undo, separately remembered for each line. .TP .B revert\-line (M\-r) Undo all changes made to this line. This is like executing the .B undo command enough times to return the line to its initial state. .TP .B tilde\-expand (M\-&) Perform tilde expansion on the current word. .TP .B set\-mark (C\-@, M\-) Set the mark to the current point. If a numeric argument is supplied, the mark is set to that position. .TP .B exchange\-point\-and\-mark (C\-x C\-x) Swap the point with the mark. The current cursor position is set to the saved position, and the old cursor position is saved as the mark. .TP .B character\-search (C\-]) A character is read and point is moved to the next occurrence of that character. A negative count searches for previous occurrences. .TP .B character\-search\-backward (M\-C\-]) A character is read and point is moved to the previous occurrence of that character. A negative count searches for subsequent occurrences. .TP .B insert\-comment (M\-#) The value of the .B readline .B comment\-begin variable is inserted at the beginning of the current line, and the line is accepted as if a newline had been typed. This makes the current line a shell comment. .TP .B glob\-expand\-word (C\-x *) The word before point is treated as a pattern for pathname expansion, and the list of matching file names is inserted, replacing the word. .TP .B glob\-list\-expansions (C\-x g) The list of expansions that would have been generated by .B glob\-expand\-word is displayed, and the line is redrawn. .TP .B dump\-functions Print all of the functions and their key bindings to the readline output stream. 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 .B dump\-variables Print all of the settable readline variables and their values to the readline output stream. 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 .B dump\-macros Print all of the readline key sequences bound to macros and the strings they ouput. 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 .B display\-shell\-version (C\-x C\-v) Display version information about the current instance of .BR bash . .PD .SH HISTORY When the .B \-o history option to the .B set builtin is enabled, the shell provides access to the \fIcommand history\fP, the list of commands previously typed. The text of the last .SM .B HISTSIZE commands (default 500) is saved in a history list. The shell stores each command in the history list prior to parameter and variable expansion (see .SM .B EXPANSION above) but after history expansion is performed, subject to the values of the shell variables .SM .B HISTIGNORE and .SM .BR HISTCONTROL . On startup, the history is initialized from the file named by the variable .SM .B HISTFILE (default \fI~/.bash_history\fP). .SM .B HISTFILE is truncated, if necessary, to contain no more than .SM .B HISTFILESIZE lines. When an interactive shell exits, the last .SM .B HISTSIZE lines are copied from the history list to .SM .BR HISTFILE . If the .B histappend shell option is enabled (see the description of .B shopt under .SM .B "SHELL BUILTIN COMMANDS" below), the lines are appended to the history file, otherwise the history file is overwritten. If .SM .B HISTFILE is unset, or if the history file is unwritable, the history is not saved. After saving the history, the history file is truncated to contain no more than .SM .B HISTFILESIZE lines. If .SM .B HISTFILESIZE is not set, no truncation is performed. .PP The builtin command .B fc (see .SM .B SHELL BUILTIN COMMANDS below) may be used to list or edit and re-execute a portion of the history list. The .B history builtin can be used to display or modify the history list and manipulate the history file. When using the command-line editing, search commands are available in each editing mode that provide access to the history list. .PP The shell allows control over which commands are saved on the history list. The .SM .B HISTCONTROL and .SM .B HISTIGNORE variables may be set to cause the shell to save only a subset of the commands entered. The .B cmdhist shell option, if enabled, causes the shell to attempt to save each line of a multi-line command in the same history entry, adding semicolons where necessary to preserve syntactic correctness. The .B lithist shell option causes the shell to save the command with embedded newlines instead of semicolons. See the description of the .B shopt builtin below under .SM .B "SHELL BUILTIN COMMANDS" for information on setting and unsetting shell options. .SH "HISTORY EXPANSION" .PP The shell supports a history expansion feature that is similar to the history expansion in .BR csh. This section describes what syntax features are available. This feature is enabled by default for interactive shells, and can be disabled using the .B \+H option to the .B set builtin command (see .SM .B SHELL BUILTIN COMMANDS below). Non-interactive shells do not perform history expansion by default. .PP History expansions introduce words from the history list into the input stream, making it easy to repeat commands, insert the arguments to a previous command into the current input line, or fix errors in previous commands quickly. .PP History expansion is performed immediately after a complete line is read, before the shell breaks it into words. It takes place in two parts. The first is to determine which line from the history list to use during substitution. The second is to select portions of that line for inclusion into the current one. The line selected from the history is the \fIevent\fP, and the portions of that line that are acted upon are \fIwords\fP. Various \fImodifiers\fP are available to manipulate the selected words. The line is broken into words in the same fashion as when reading input, so that several \fImetacharacter\fP-separated words surrounded by quotes are considered one word. History expansions are introduced by the appearance of the history expansion character, which is \^\fB!\fP\^ by default. Only backslash (\^\fB\e\fP\^) and single quotes can quote the history expansion character. .PP Several shell options settable with the .B shopt builtin may be used to tailor the behavior of history expansion. If the .B histverify shell option is enabled (see the description of the .B shopt builtin), and .B readline is being used, history substitutions are not immediately passed to the shell parser. Instead, the expanded line is reloaded into the .B readline editing buffer for further modification. If .B readline is being used, and the .B histreedit shell option is enabled, a failed history substitution will be reloaded into the .B readline editing buffer for correction. The .B \-p option to the .B history builtin command may be used to see what a history expansion will do before using it. The .B \-s option to the .B history builtin may be used to add commands to the end of the history list without actually executing them, so that they are available for subsequent recall. .PP The shell allows control of the various characters used by the history expansion mechanism (see the description of .B histchars above under .BR "Shell Variables" ). .SS Event Designators .PP An event designator is a reference to a command line entry in the history list. .PP .PD 0 .TP .B ! Start a history substitution, except when followed by a .BR blank , newline, = or (. .TP .B !\fIn\fR Refer to command line .IR n . .TP .B !\-\fIn\fR Refer to the current command line minus .IR n . .TP .B !! Refer to the previous command. This is a synonym for `!\-1'. .TP .B !\fIstring\fR Refer to the most recent command starting with .IR string . .TP .B !?\fIstring\fR\fB[?]\fR Refer to the most recent command containing .IR string . The trailing \fB?\fP may be omitted if .I string is followed immediately by a newline. .TP .B \d\s+2^\s-2\u\fIstring1\fP\d\s+2^\s-2\u\fIstring2\fP\d\s+2^\s-2\u Quick substitution. Repeat the last command, replacing .I string1 with .IR string2 . Equivalent to ``!!:s/\fIstring1\fP/\fIstring2\fP/'' (see \fBModifiers\fP below). .TP .B !# The entire command line typed so far. .PD .SS Word Designators .PP Word designators are used to select desired words from the event. A .B : separates the event specification from the word designator. It may be omitted if the word designator begins with a .BR ^ , .BR $ , .BR * , .BR \- , or .BR % . Words are numbered from the beginning of the line, with the first word being denoted by 0 (zero). Words are inserted into the current line separated by single spaces. .PP .PD 0 .TP .B 0 (zero) The zeroth word. For the shell, this is the command word. .TP .I n The \fIn\fRth word. .TP .B ^ The first argument. That is, word 1. .TP .B $ The last argument. .TP .B % The word matched by the most recent `?\fIstring\fR?' search. .TP .I x\fB\-\fPy A range of words; `\-\fIy\fR' abbreviates `0\-\fIy\fR'. .TP .B * All of the words but the zeroth. This is a synonym for `\fI1\-$\fP'. It is not an error to use .B * if there is just one word in the event; the empty string is returned in that case. .TP .B x* Abbreviates \fIx\-$\fP. .TP .B x\- Abbreviates \fIx\-$\fP like \fBx*\fP, but omits the last word. .PD .PP If a word designator is supplied without an event specification, the previous command is used as the event. .SS Modifiers .PP After the optional word designator, there may appear a sequence of one or more of the following modifiers, each preceded by a `:'. .PP .PD 0 .PP .TP .B h Remove a trailing file name component, leaving only the head. .TP .B t Remove all leading file name components, leaving the tail. .TP .B r Remove a trailing suffix of the form \fI.xxx\fP, leaving the basename. .TP .B e Remove all but the trailing suffix. .TP .B p Print the new command but do not execute it. .TP .B q Quote the substituted words, escaping further substitutions. .TP .B x Quote the substituted words as with .BR q , but break into words at .B blanks and newlines. .TP .B s/\fIold\fP/\fInew\fP/ Substitute .I new for the first occurrence of .I old in the event line. Any delimiter can be used in place of /. The final delimiter is optional if it is the last character of the event line. The delimiter may be quoted in .I old and .I new with a single backslash. If & appears in .IR new , it is replaced by .IR old . A single backslash will quote the &. If .I old is null, it is set to the last .I old substituted, or, if no previous history substitutions took place, the last .I string in a .B !?\fIstring\fR\fB[?]\fR search. .TP .B & Repeat the previous substitution. .TP .B g Cause changes to be applied over the entire event line. This is used in conjunction with `\fB:s\fP' (e.g., `\fB:gs/\fIold\fP/\fInew\fP/\fR') or `\fB:&\fP'. If used with `\fB:s\fP', any delimiter can be used in place of /, and the final delimiter is optional if it is the last character of the event line. .PD .SH "SHELL BUILTIN COMMANDS" .\" start of bash builtins .zZ .PP Unless otherwise noted, each builtin command documented in this section as accepting options preceded by .B \- accepts .B \-\- to signify the end of the options. .sp .5 .PD 0 .TP \fB:\fP [\fIarguments\fP] .PD No effect; the command does nothing beyond expanding .I arguments and performing any specified redirections. A zero exit code is returned. .TP .PD 0 \fB .\| \fP \fIfilename\fP [\fIarguments\fP] .TP \fBsource\fP \fIfilename\fP [\fIarguments\fP] .PD Read and execute commands from .I filename in the current shell environment and return the exit status of the last command executed from .IR filename . If .I filename does not contain a slash, file names in .SM .B PATH are used to find the directory containing .IR filename . The file searched for in .SM .B PATH need not be executable. The current directory is searched if no file is found in .SM .BR PATH . If the .B sourcepath option to the .B shopt builtin command is turned off, the .SM .B PATH is not searched. If any \fIarguments\fP are supplied, they become the positional parameters when \fIfilename\fP is executed. Otherwise the positional parameters are unchanged. The return status is the status of the last command exited within the script (0 if no commands are executed), and false if .I filename is not found or cannot be read. .TP \fBalias\fP [\fB\-p\fP] [\fIname\fP[=\fIvalue\fP] ...] \fBAlias\fP with no arguments or with the .B \-p option prints the list of aliases in the form \fBalias\fP \fIname\fP=\fIvalue\fP on standard output. When arguments are supplied, an alias is defined for each \fIname\fP whose \fIvalue\fP is given. A trailing space in \fIvalue\fP causes the next word to be checked for alias substitution when the alias is expanded. For each \fIname\fP in the argument list for which no \fIvalue\fP 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 had been started with .BR & . If \fIjobspec\fP is not present, the shell's notion of the \fIcurrent job\fP is used. .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. .TP .PD 0 \fBbind\fP [\fB\-m\fP \fIkeydirectorie\fP] [\fB\-lpsvPSV\fP] .TP \fBbind\fP [\fB\-m\fP \fIkeydirectorie\fP] [\fB\-q\fP \fIfunction\fP] [\fB\-u\fP \fIfunction\fP] [\fB\-r\fP \fIkeyseq\fP] .TP \fBbind\fP [\fB\-m\fP \fIkeydirectorie\fP] \fB\-f\fP \fIfilename\fP .TP \fBbind\fP [\fB\-m\fP \fIkeydirectorie\fP] \fIkeyseq\fP:\fIfunction\-name\fP .PD Display current .B readline key and function bindings, or bind a key sequence to a .B readline function or macro. The binding syntax accepted is identical to that of .IR .inputrc , but each binding must be passed as a separate argument; e.g., '"\eC\-x\eC\-r": re\-read\-init\-file'. Options, if supplied, have the following meanings: .RS .PD 0 .TP .B \-m \fIkeydirectorie\fP Use .I keydirectorie as the keydir to be affected by the subsequent bindings. Acceptable .I keydirectorie names are \fIemacs, emacs\-standard, emacs\-meta, emacs\-ctlx, vi, vi\-command\fP, and .IR vi\-insert . \fIvi\fP is equivalent to \fIvi\-command\fP; \fIemacs\fP is equivalent to \fIemacs\-standard\fP. .TP .B \-l List the names of all \fBreadline\fP functions. .TP .B \-p Display \fBreadline\fP function names and bindings in such a way that they can be re-read. .TP .B \-P List current \fBreadline\fP function names and bindings. .TP .B \-v Display \fBreadline\fP variable names and values in such a way that they can be re-read. .TP .B \-V List current \fBreadline\fP variable names and values. .TP .B \-s Display \fBreadline\fP key sequences bound to macros and the strings they output in such a way that they can be re-read. .TP .B \-S Display \fBreadline\fP key sequences bound to macros and the strings they output. .TP .B \-f \fIfilename\fP Read key bindings from \fIfilename\fP. .TP .B \-q \fIfunction\fP Query about which keys invoke the named \fIfunction\fP. .TP .B \-u \fIfunction\fP Unbind all keys bound to the named \fIfunction\fP. .TP .B \-r \fIkeyseq\fP Remove any current binding for \fIkeyseq\fP. .PD .PP The return value is 0 unless an unrecognized option is given or an error occurred. .RE .TP \fBbreak\fP [\fIn\fP] Exit from within a .BR for , .BR while , .BR until , or .B select loop. If \fIn\fP is specified, break \fIn\fP levels. .I n must be \(>= 1. If .I n is greater than the number of enclosing loops, all enclosing loops are exited. The return value is 0 unless the shell is not executing a loop when .B break is executed. .TP \fBbuiltin\fP \fIshell\-builtin\fP [\fIarguments\fP] Execute the specified shell builtin, passing it .IR arguments , and return its exit status. This is useful when defining a function whose name is the same as a shell builtin, retaining the functionality of the builtin within the function. The \fBcd\fP builtin is commonly redefined this way. The return status is false if .I shell\-builtin is not a shell builtin command. .TP \fBcd\fP [\fB\-LP\fP] [\fIdir\fP] Change the current directory to \fIdir\fP. The variable .SM .B HOME is the default .IR dir . The variable .SM .B CDPATH defines the search path for the directory containing .IR dir . Alternative directory names in .SM .B CDPATH are separated by a colon (:). A null directory name in .SM .B CDPATH is the same as the current directory, i.e., ``\fB.\fP''. If .I dir begins with a slash (/), then .SM .B CDPATH is not used. The .B \-P option says to use the physical directory structure instead of following symbolic links (see also the .B \-P option to the .B set builtin command); the .B \-L option forces symbolic links to be followed. An argument of .B \- is equivalent to .SM .BR $OLDPWD . The return value is true if the directory was successfully changed; false otherwise. .TP \fBcommand\fP [\fB\-pVv\fP] \fIcommand\fP [\fIarg\fP ...] Run .I command with .I args suppressing the normal shell function lookup. Only builtin commands or commands found in the .SM .B PATH are executed. If the .B \-p option is given, the search for .I command is performed using a default value for .B PATH that is guaranteed to find all of the standard utilities. If either the .B \-V or .B \-v option is supplied, a description of .I command is printed. The .B \-v option causes a single word indicating the command or file name used to invoke .I command to be displayed; the .B \-V option produces a more verbose description. If the .B \-V or .B \-v option is supplied, the exit status is 0 if .I command was found, and 1 if not. If neither option is supplied and an error occurred or .I command cannot be found, the exit status is 127. Otherwise, the exit status of the .B command builtin is the exit status of .IR command . .TP \fBcontinue\fP [\fIn\fP] Resume the next iteration of the enclosing .BR for , .BR while , .BR until , or .B select loop. If .I n is specified, resume at the \fIn\fPth enclosing loop. .I n must be \(>= 1. If .I n is greater than the number of enclosing loops, the last enclosing loop (the ``top-level'' loop) is resumed. The return value is 0 unless the shell is not executing a loop when .B continue is executed. .TP .PD 0 \fBdeclare\fP [\fB\-afFirx\fP] [\fB\-p\fP] [\fIname\fP[=\fIvalue\fP]] .TP \fBtypeset\fP [\fB\-afFirx\fP] [\fB\-p\fP] [\fIname\fP[=\fIvalue\fP]] .PD Declare variables and/or give them attributes. If no \fIname\fPs are given then display the values of variables. The .B \-p option will display the attributes and values of each .IR name . When .B \-p is used, additional options are ignored. The .B \-F option inhibits the display of function definitions; only the function name and attributes are printed. The .B \-F option implies .BR \-f . The following options can be used to restrict output to variables with the specified attribute or to give variables attributes: .RS .PD 0 .TP .B \-a Each \fIname\fP is an array variable (see .B Arrays above). .TP .B \-f Use function names only. .TP .B \-i The variable is treated as an integer; arithmetic evaluation (see .SM .B "ARITHMETIC EVALUATION" ") " is performed when the variable is assigned a value. .TP .B \-r Make \fIname\fPs readonly. These names cannot then be assigned values by subsequent assignment statements or unset. .TP .B \-x Mark \fIname\fPs for export to subsequent commands via the environment. .PD .PP Using `+' instead of `\-' turns off the attribute instead, with the exception that \fB+a\fP may not be used to destroy an array variable. When used in a function, makes each \fIname\fP local, as with the .B local command. The return value is 0 unless an invalid option is encountered, an attempt is made to define a function using "\-f foo=bar", an attempt is made to assign a value to a readonly variable, an attempt is made to assign a value to an array variable without using the compound assignment syntax (see .B Arrays above), one of the \fInames\fP is not a valid shell variable name, an attempt is made to turn off readonly status for a readonly variable, an attempt is made to turn off array status for an array variable, or an attempt is made to display a non-existent function with \-f. .RE .TP .B directories [\fB\-clpv\fP] [+\fIn\fP] [\-\fIn\fP] Without options, displays the list of currently remembered directories. The default display is on a single line with directory names separated by spaces. Directories are added to the list with the .B pushd command; the .B popd command removes entries from the list. .RS .PD 0 .TP \fB+\fP\fIn\fP Displays the \fIn\fPth entry counting from the left of the list shown by .B directories when invoked without options, starting with zero. .TP \fB\-\fP\fIn\fP Displays the \fIn\fPth entry counting from the right of the list shown by .B directories when invoked without options, starting with zero. .TP .B \-c Clears the directory stack by deleting all of the entries. .TP .B \-l Produces a longer listing; the default listing format uses a tilde to denote the home directory. .TP .B \-p Print the directory stack with one entry per line. .TP .B \-v Print the directory stack with one entry per line, prefixing each entry with its index in the stack. .PD .PP The return value is 0 unless an invalid option is supplied or \fIn\fP indexes beyond the end of the directory stack. .RE .TP \fBdisown\fP [\fB\-ar\fP] [\fB\-h\fP] [\fIjobspec\fP ...] Without options, each .I jobspec is removed from the table of active jobs. If the \fB\-h\fP option is given, each .I jobspec is not removed from the table, but is marked so that .SM .B SIGHUP is not sent to the job if the shell receives a .SM .BR SIGHUP . If no .I jobspec is present, and neither the .B \-a nor the .B \-r option is supplied, the \fIcurrent job\fP is used. If no .I jobspec is supplied, the .B \-a option means to remove or mark all jobs; the .B \-r option without a .I jobspec argument restricts operation to running jobs. The return value is 0 unless a .I jobspec does not specify a valid job. .TP \fBecho\fP [\fB\-neE\fP] [\fIarg\fP ...] Output the \fIarg\fPs, separated by spaces, followed by a newline. The return status is always 0. If \fB\-n\fP is specified, the trailing newline is suppressed. If the \fB\-e\fP option is given, interpretation of the following backslash-escaped characters is enabled. The .B \-E option disables the interpretation of these escape characters, even on systems where they are interpreted by default. .B echo does not interpret .B \-\- to mean the end of options. .B echo interprets the following escape sequences: .RS .PD 0 .TP .B \ea alert (bell) .TP .B \eb backspace .TP .B \ec suppress trailing newline .TP .B \ee an escape character .TP .B \ef form feed .TP .B \en new line .TP .B \er carriage return .TP .B \et horizontal tab .TP .B \ev vertical tab .TP .B \e\e backslash .TP .B \e\fInnn\fP the character whose ASCII code is the octal value \fInnn\fP (one to three digits) .TP .B \ex\fInnn\fP the character whose ASCII code is the hexadecimal value \fInnn\fP (one to three digits) .PD .RE .TP \fBenable\fP [\fB\-adnps\fP] [\fB\-f\fP \fIfilename\fP] [\fIname\fP ...] Enable and disable builtin shell commands. Disabling a builtin allows a disk command which has the same name as a shell builtin to be executed with specifying a full pathname, even though the shell normally searches for builtins before disk commands. If \fB\-n\fP is used, each \fIname\fP is disabled; otherwise, \fInames\fP are enabled. For example, to use the .B test binary found via the .SM .B PATH instead of the shell builtin version, run \f(CWenable -n test\fP. The .B \-f option means to load the new builtin command .I name from shared object .IR filename , on systems that support dynamic loading. The .B \-d option will delete a builtin previously loaded with .BR \-f . If no \fIname\fP arguments are given, or if the .B \-p option is supplied, a list of shell builtins is printed. With no other option arguments, the list consists of all enabled shell builtins. If \fB\-n\fP is supplied, only disabled builtins are printed. If \fB\-a\fP is supplied, the list printed includes all builtins, with an indication of whether or not each is enabled. If \fB\-s\fP is supplied, the output is restricted to the POSIX \fIspecial\fP builtins. The return value is 0 unless a .I name is not a shell builtin or there is a problem loading a new builtin from a shared object. .TP \fBeval\fP [\fIarg\fP ...] The \fIarg\fPs are read and concatenated together into a single command. This command is then read and executed by the shell, and its exit status is returned as the value of .BR eval . If there are no .IR args , or only null arguments, .B eval returns 0. .TP \fBexec\fP [\fB\-cl\fP] [\fB\-a\fP \fIname\fP] [\fIcommand\fP [\fIarguments\fP]] If .I command is specified, it replaces the shell. No new process is created. The .I arguments become the arguments to \fIcommand\fP. If the .B \-l option is supplied, the shell places a dash in the zeroth arg passed to .IR command . This is what .IR login (1) does. The .B \-c option causes .I command to be executed with an empty environment. If .B \-a is supplied, the shell passes .I name as the zeroth argument to the executed command. If .I command cannot be executed for some reason, a non-interactive shell exits, unless the shell option .B execfail is enabled, in which case it returns failure. An interactive shell returns failure if the file cannot be executed. If .I command is not specified, any redirections take effect in the current shell, and the return status is 0. If there is a redirection error, the return status is 1. .TP \fBexit\fP [\fIn\fP] Cause the shell to exit with a status of \fIn\fP. If .I n is omitted, the exit status is that of the last command executed. A trap on .SM .B EXIT is executed before the shell terminates. .TP .PD 0 \fBexport\fP [\fB\-fn\fP\^] [\fIname\fP[=\fIword\fP]] ... .TP .B export \-p .PD The supplied .I names are marked for automatic export to the environment of subsequently executed commands. If the .B \-f option is given, the .I names refer to functions. If no .I names are given, or if the .B \-p option is supplied, a list of all names that are exported in this shell is printed. The .B \-n option causes the export property to be removed from the named variables. .B export returns an exit status of 0 unless an invalid option is encountered, one of the \fInames\fP is not a valid shell variable name, or .B \-f is supplied with a .I name that is not a function. .TP .PD 0 \fBfc\fP [\fB\-e\fP \fIename\fP] [\fB\-nlr\fP] [\fIfirst\fP] [\fIlast\fP] .TP \fBfc\fP \fB\-s\fP [\fIpat\fP=\fIrep\fP] [\fIcmd\fP] .PD Fix Command. In the first form, a range of commands from .I first to .I last is selected from the history list. .I First and .I last may be specified as a string (to locate the last command beginning with that string) or as a number (an index into the history list, where a negative number is used as an offset from the current command number). If .I last is not specified it is set to the current command for listing (so that .B fc \-l \-10 prints the last 10 commands) and to .I first otherwise. If .I first is not specified it is set to the previous command for editing and \-16 for listing. .sp 1 The .B \-n option suppresses the command numbers when listing. The .B \-r option reverses the order of the commands. If the .B \-l option is given, the commands are listed on standard output. Otherwise, the editor given by .I ename is invoked on a file containing those commands. If .I ename is not given, the value of the .SM .B FCEDIT variable is used, and the value of .SM .B EDITOR if .SM .B FCEDIT is not set. If neither variable is set, .FN vi is used. When editing is complete, the edited commands are echoed and executed. .sp 1 In the second form, \fIcommand\fP is re-executed after each instance of \fIpat\fP is replaced by \fIrep\fP. A useful alias to use with this is .if n ``r=fc -s'', .if t \f(CWr='fc \-s'\fP, so that typing .if n ``r cc'' .if t \f(CWr cc\fP runs the last command beginning with .if n ``cc'' .if t \f(CWcc\fP and typing .if n ``r'' .if t \f(CWr\fP re-executes the last command. .sp 1 If the first form is used, the return value is 0 unless an invalid option is encountered or .I first or .I last specify history lines out of range. If the .B \-e option is supplied, the return value is the value of the last command executed or failure if an error occurs with the temporary file of commands. If the second form is used, the return status is that of the command re-executed, unless .I cmd does not specify a valid history line, in which case .B fc returns failure. .TP \fBfg\fP [\fIjobspec\fP] Resume .I jobspec in the foreground, and make it the current job. If .I jobspec is not present, the shell's notion of the \fIcurrent job\fP is used. The return value is that of the command placed into the foreground, or failure if run when job control is disabled or, when run with job control enabled, if .I jobspec does not specify a valid job or .I jobspec specifies a job that was started without job control. .TP \fBgetopts\fP \fIoptstring\fP \fIname\fP [\fIargs\fP] .B getopts is used by shell procedures to parse positional parameters. .I optstring contains the option letters to be recognized; if a letter is followed by a colon, the option is expected to have an argument, which should be separated from it by white space. Each time it is invoked, .B getopts places the next option in the shell variable .IR name , initializing .I name if it does not exist, and the index of the next argument to be processed into the variable .SM .BR OPTIND . .SM .B OPTIND is initialized to 1 each time the shell or a shell script is invoked. When an option requires an argument, .B getopts places that argument into the variable .SM .BR OPTARG . The shell does not reset .SM .B OPTIND automatically; it must be manually reset between multiple calls to .B getopts within the same shell invocation if a new set of parameters is to be used. .sp 1 When the end of options is encountered, \fBgetopts\fP exits with a return value greater than zero. \fBOPTIND\fP is set to the index of the first non-option argument, and \fBname\fP is set to ?. .sp 1 .B getopts normally parses the positional parameters, but if more arguments are given in .IR args , .B getopts parses those instead. .sp 1 .B getopts can report errors in two ways. If the first character of .I optstring is a colon, .I silent error reporting is used. In normal operation diagnostic messages are printed when invalid options or missing option arguments are encountered. If the variable .SM .B OPTERR is set to 0, no error messages will be displayed, even if the first character of .I optstring is not a colon. .sp 1 If an invalid option is seen, .B getopts places ? into .I name and, if not silent, prints an error message and unsets .SM .BR OPTARG . If .B getopts is silent, the option character found is placed in .SM .B OPTARG and no diagnostic message is printed. .sp 1 If a required argument is not found, and .B getopts is not silent, a question mark (\^\fB?\fP\^) is placed in .IR name , .B OPTARG is unset, and a diagnostic message is printed. If .B getopts is silent, then a colon (\^\fB:\fP\^) is placed in .I name and .SM .B OPTARG is set to the option character found. .sp 1 .B getopts returns true if an option, specified or unspecified, is found. It returns false if the end of options is encountered or an error occurs. .TP \fBhash\fP [\fB\-r\fP] [\fB\-p\fP \fIfilename\fP] [\fIname\fP] For each .IR name , the full file name of the command is determined by searching the directories in .B $PATH and remembered. If the .B \-p option is supplied, no path search is performed, and .I filename is used as the full file name of the command. The .B \-r option causes the shell to forget all remembered locations. If no arguments are given, information about remembered commands is printed. The return status is true unless a .I name is not found or an invalid option is supplied. .TP \fBhelp\fP [\fIpattern\fP] Display helpful information about builtin commands. If .I pattern is specified, .B help gives detailed help on all commands matching .IR pattern ; otherwise help for all the builtins and shell control structures is printed. The return status is 0 unless no command matches .IR pattern . .TP .PD 0 \fBhistory\fP [\fB\-c\fP] [\fIn\fP] .TP \fBhistory\fP \fB\-anrw\fP [\fIfilename\fP] .TP \fBhistory\fP \fB\-p\fP \fIarg\fP [\fIarg ...\fP] .TP \fBhistory\fP \fB\-s\fP \fIarg\fP [\fIarg ...\fP] .PD With no options, display the command history list with line numbers. Lines listed with a .B * have been modified. An argument of .I n lists only the last .I n lines. If \fIfilename\fP is supplied, it is used as the name of the history file; if not, the value of .SM .B HISTFILE is used. Options, if supplied, have the following meanings: .RS .PD 0 .TP .B \-a Append the ``new'' history lines (history lines entered since the beginning of the current \fBbash\fP session) to the history file. .TP .B \-n Read the history lines not already read from the history file into the current history list. These are lines appended to the history file since the beginning of the current \fBbash\fP session. .TP .B \-r Read the contents of the history file and use them as the current history. .TP .B \-w Write the current history to the history file, overwriting the history file's contents. .TP .B \-c Clear the history list by deleting all the entries. .TP .B \-p Perform history substitution on the following \fIargs\fP and display the result on the standard output. Does not store the results in the history list. Each \fIarg\fP must be quoted to disable normal history expansion. .TP .B \-s Store the .I args in the history list as a single entry. The last command in the history list is removed before the .I args are added. .PD .PP The return value is 0 unless an invalid option is encountered or an error occurs while reading or writing the history file. .RE .TP .PD 0 \fBjobs\fP [\fB\-lnprs\fP] [ \fIjobspec\fP ... ] .TP \fBjobs\fP \fB\-x\fP \fIcommand\fP [ \fIargs\fP ... ] .PD The first form lists the active jobs. The options have the following meanings: .RS .PD 0 .TP .B \-l List process IDs in addition to the normal information. .TP .B \-p List only the process ID of the job's process group leader. .TP .B \-n Display information only about jobs that have changed status since the user was last notified of their status. .TP .B \-r Restrict output to running jobs. .TP .B \-s Restrict output to stopped jobs. .PD .PP If .I jobspec is given, output is restricted to information about that job. The return status is 0 unless an invalid option is encountered or an invalid .I jobspec is supplied. .PP If the .B \-x option is supplied, .B jobs replaces any .I jobspec found in .I command or .I args with the corresponding process group ID, and executes .I command passing it .IR args , returning its exit status. .RE .TP .PD 0 \fBkill\fP [\fB\-s\fP \fIsigspec\fP | \fB\-n\fP \fIsignum\fP | \fB\-\fP\fIsigspec\fP] [\fIpid\fP | \fIjobspec\fP] ... .TP \fBkill\fP \fB\-l\fP [\fIsigspec\fP | \fIexit_status\fP] .PD Send the signal named by .I sigspec or .I signum to the processes named by .I pid or .IR jobspec . .I sigspec is either a signal name such as .SM .B SIGKILL or a signal number; .I signum is a signal number. If .I sigspec is a signal name, the name may be given with or without the .SM .B SIG prefix. If .I sigspec is not present, then .SM .B SIGTERM is assumed. An argument of .B \-l lists the signal names. If any arguments are supplied when .B \-l is given, the names of the signals corresponding to the arguments are listed, and the return status is 0. The \fIexit_status\fP argument to .B \-l is a number specifying either a signal number or the exit status of a process terminated by a signal. .B kill returns true if at least one signal was successfully sent, or false if an error occurs or an invalid option is encountered. .TP \fBlet\fP \fIarg\fP [\fIarg\fP ...] Each .I arg is an arithmetic expression to be evaluated (see .SM .BR "ARITHMETIC EVALUATION" ). If the last .I arg evaluates to 0, .B let returns 1; 0 is returned otherwise. .TP \fBlocal\fP [\fIname\fP[=\fIvalue\fP] ...] For each argument, a local variable named .I name is created, and assigned .IR value . When .B local is used within a function, it causes the variable .I name to have a visible scope restricted to that function and its children. With no operands, .B local writes a list of local variables to the standard output. It is an error to use .B local when not within a function. The return status is 0 unless .B local is used outside a function, or an invalid .I name is supplied. .TP .B logout Exit a login shell. .TP \fBpopd\fP [\-\fBn\fP] [+\fIn\fP] [\-\fIn\fP] Removes entries from the directory stack. With no arguments, removes the top directory from the stack, and performs a .B cd to the new top directory. Arguments, if supplied, have the following meanings: .RS .PD 0 .TP \fB+\fP\fIn\fP Removes the \fIn\fPth entry counting from the left of the list shown by .BR directories , starting with zero. For example: ``popd +0'' removes the first directory, ``popd +1'' the second. .TP \fB\-\fP\fIn\fP Removes the \fIn\fPth entry counting from the right of the list shown by .BR directories , starting with zero. For example: ``popd -0'' removes the last directory, ``popd -1'' the next to last. .TP .B \-n Suppresses the normal change of directory when removing directories from the stack, so that only the stack is manipulated. .PD .PP If the .B popd command is successful, a .B directories is performed as well, and the return status is 0. .B popd returns false if an invalid option is encountered, the directory stack is empty, a non-existent directory stack entry is specified, or the directory change fails. .RE .TP \fBprintf\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: plain characters, which are simply copied to standard output, character escape sequences, which are converted and copied to the standard output, and format specifications, each of which causes printing of the next successive \fIargument\fP. In addition to the standard \fIprintf\fP(1) formats, %b causes \fBprintf\fP to expand backslash escape sequences in the corresponding \fIargument\fP, and %q causes \fBprintf\fP to output the corresponding \fIargument\fP in a format that can be reused as shell input. .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 appropriate, had been supplied. .TP .PD 0 \fBpushd\fP [\fB\-n\fP] [\fIdir\fP] .TP \fBpushd\fP [\fB\-n\fP] [+\fIn\fP] [\-\fIn\fP] .PD Adds a directory to the top of the directory stack, or rotates the stack, making the new top of the stack the current working directory. With no arguments, exchanges the top two directories and returns 0, unless the directory stack is empty. Arguments, if supplied, have the following meanings: .RS .PD 0 .TP \fB+\fP\fIn\fP Rotates the stack so that the \fIn\fPth directory (counting from the left of the list shown by .BR directories , starting with zero) is at the top. .TP \fB\-\fP\fIn\fP Rotates the stack so that the \fIn\fPth directory (counting from the right of the list shown by .BR directories , starting with zero) is at the top. .TP .B \-n Suppresses the normal change of directory when adding directories to the stack, so that only the stack is manipulated. .TP .B dir Adds .I dir to the directory stack at the top, making it the new current working directory. .PD .PP If the .B pushd command is successful, a .B directories is performed as well. If the first form is used, .B pushd returns 0 unless the cd to .I dir fails. With the second form, .B pushd returns 0 unless the directory stack is empty, a non-existent directory stack element is specified, or the directory change to the specified new current directory fails. .RE .TP \fBpwd\fP [\fB\-LP\fP] Print the absolute file name of the current working directory. The file name printed contains no symbolic links if the .B \-P option is supplied or the .B \-o physical option to the .B set builtin command is enabled. If the .B \-L option is used, symbolic links are followed. The return status is 0 unless an error occurs while reading the name of the current directory or an invalid option is supplied. .TP \fBread\fP [\fB\-er\fP] [\fB\-a\fP \fIaname\fP] [\fB\-p\fP \fIprompt\fP] [\fIname\fP ...] One line is read from the standard input, and the first word is assigned to the first .IR name , the second word to the second .IR name , and so on, with leftover words and their intervening separators assigned to the last .IR name . If there are fewer words read from the standard input than names, the remaining names are assigned empty values. The characters in .SM .B IFS are used to split the line into words. The backslash character (\fB\e\fP) may be used to remove any special meaning for the next character read and for line continuation. Options, if supplied, have the following meanings: .RS .PD 0 .TP .B \-r Backslash does not act as an escape character. The backslash is considered to be part of the line. In particular, a backslash-newline pair may not be used as a line continuation. .TP .B \-p Display \fIprompt\fP, without a trailing newline, before attempting to read any input. The prompt is displayed only if input is coming from a terminal. .TP .B \-a The words are assigned to sequential indices of the array variable .IR aname , starting at 0. .I aname is unset before any new values are assigned. Other \fIname\fP arguments are ignored. .TP .B \-e If the standard input is coming from a terminal, .B readline (see .SM .B READLINE above) is used to obtain the line. .PD .PP If no .I names are supplied, the line read is assigned to the variable .SM .BR REPLY . The return code is zero, unless end-of-file is encountered. .RE .TP \fBreadonly\fP [\fB\-apf\fP] [\fIname\fP ...] .PD The given \fInames\fP are marked readonly; the values of these .I names may not be changed by subsequent assignment. If the .B \-f option is supplied, the functions corresponding to the \fInames\fP are so marked. The .B \-a option restricts the variables to arrays. If no .I name arguments are given, or if the .B \-p option is supplied, a list of all readonly names is printed. The .B \-p option causes output to be displayed in a format thatmay be reused as input. The return status is 0 unless an invalid option is encountered, one of the .I names is not a valid shell variable name, or .B \-f is supplied with a .I name that is not a function. .TP \fBreturn\fP [\fIn\fP] Causes a function to exit with the return value specified by .IR n . If .I n is omitted, the return status is that of the last command executed in the function body. If used outside a function, but during execution of a script by the .B . (\fBsource\fP) command, it causes the shell to stop executing that script and return either .I n or the exit status of the last command executed within the script as the exit status of the script. If used outside a function and not during execution of a script by \fB.\fP\^, the return status is false. .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. 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 as values for the positional parameters and are assigned, in order, to .BR $1 , .BR $2 , .B ... .BR $\fIn\fP . Options, if specified, have the following meanings: .RS .PD 0 .TP 8 .B \-a Automatically mark variables which are modified or created for export to the environment of subsequent commands. .TP 8 .B \-b Report the status of terminated background jobs immediately, rather than before the next primary prompt. This is effective only when job control is enabled. .TP 8 .B \-e Exit immediately if a \fIsimple command\fP (see .SM .B SHELL GRAMMAR above) exits with a non-zero status. The shell does not exit if the command that fails is part of an .I until or .I while loop, part of an .I if statement, part of a .B && or .B \(bv\(bv list, or if the command's return value is being inverted via .BR ! . .TP 8 .B \-f Disable pathname expansion. .TP 8 .B \-h Remember the location of commands as they are looked up for execution. This is enabled by default. .TP 8 .B \-k All arguments in the form of assignment statements are placed in the environment for a command, not just those that precede the command name. .TP 8 .B \-m Monitor mode. Job control is enabled. This option is on by default for interactive shells on systems that support it (see .SM .B JOB CONTROL above). Background processes run in a separate process group and a line containing their exit status is printed upon their completion. .TP 8 .B \-n Read commands but do not execute them. This may be used to check a shell script for syntax errors. This is ignored by interactive shells. .TP 8 .B \-o \fIoption\-name\fP The \fIoption\-name\fP can be one of the following: .RS .TP 8 .B allexport Same as .BR \-a . .TP 8 .B braceexpand Same as .BR \-B . .TP 8 .B emacs Use an emacs-style command line editing interface. This is enabled by default when the shell is interactive, unless the shell is started with the .B \-\-noediting option. .TP 8 .B errexit Same as .BR \-e . .TP 8 .B hashall Same as .BR \-h . .TP 8 .B histexpand Same as .BR \-H . .TP 8 .B history Enable command history, as described above under .SM .BR HISTORY . This option is on by default in interactive shells. .TP 8 .B ignoreeof The effect is as if the shell command \f(CWIGNOREEOF=10\fP had been executed (see .B Shell Variables above). .TP 8 .B keyword Same as .BR \-k . .TP 8 .B monitor Same as .BR \-m . .TP 8 .B noclobber Same as .BR \-C . .TP 8 .B noexec Same as .BR \-n . .TP 8 .B noglob Same as .BR \-f . .TP 8 .B notify Same as .BR \-b . .TP 8 .B nounset Same as .BR \-u . .TP 8 .B onecmd Same as .BR \-t . .TP 8 .B physical Same as .BR \-P . .TP 8 .B posix Change the behavior of .B bash where the default operation differs from the POSIX 1003.2 standard to match the standard. .TP 8 .B privileged Same as .BR \-p . .TP 8 .B verbose Same as .BR \-v . .TP 8 .B vi Use a vi-style command line editing interface. .TP 8 .B xtrace Same as .BR \-x . .sp .5 .PP If .B \-o is supplied with no \fIoption\-name\fP, the values of the current options are printed. If .B +o is supplied with no \fIoption\-name\fP, a series of .B set commands to recreate the current option settings is displayed on the standard output. .RE .TP 8 .B \-p Turn on .I privileged mode. In this mode, the .B $ENV and .B $BASH_ENV files are not processed, shell functions are not inherited from the environment, and the \fBSHELLOPTS\fP variable, if it appears in the environment, is ignored. If the shell is started with the effective user (group) id not equal to the real user (group) id, and the \fB\-p\fP option is not supplied, these actions are taken and the effective user id is set to the real user id. If the \fB\-p\fP option is supplied at startup, the effective user id is not reset. Turning this option off causes the effective user and group ids to be set to the real user and group ids. .TP 8 .B \-t Exit after reading and executing one command. .TP 8 .B \-u Treat unset variables as an error when performing parameter expansion. If expansion is attempted on an unset variable, the shell prints an error message, and, if not interactive, exits with a non-zero status. .TP 8 .B \-v Print shell input lines as they are read. .TP 8 .B \-x After expanding each \fIsimple command\fP, display the expanded value of .SM .BR PS4 , followed by the command and its expanded arguments. .TP 8 .B \-B The shell performs brace expansion (see .B Brace Expansion above). This is on by default. .TP 8 .B \-C If set, .B bash does not overwrite an existing file with the .BR > , .BR >& , and .B <> redirection operators. This may be overridden when creating output files by using the redirection operator .B >| instead of .BR > . .TP 8 .B \-H Enable .B ! style history substitution. This option is on by default when the shell is interactive. .TP 8 .B \-P If set, the shell does not follow symbolic links when executing commands such as .B cd that change the current working directory. It uses the physical directory structure instead. By default, .B bash follows the logical chain of directories when performing commands which change the current directory. .TP 8 .B \-\- If no arguments follow this option, then the positional parameters are unset. Otherwise, the positional parameters are set to the \fIarg\fPs, even if some of them begin with a .BR \- . .TP 8 .B \- Signal the end of options, cause all remaining \fIarg\fPs to be assigned to the positional parameters. The .B \-x and .B \-v options are turned off. If there are no \fIarg\fPs, the positional parameters remain unchanged. .PD .PP The options are off by default unless otherwise noted. Using + rather than \- causes these options to be turned off. The options can also be specified as arguments to an invocation of the shell. The current set of options may be found in .BR $\- . The return status is always true unless an invalid option is encountered. .RE .TP \fBshift\fP [\fIn\fP] The positional parameters from \fIn\fP+1 ... are renamed to .B $1 .B .... Parameters represented by the numbers \fB$#\fP down to \fB$#\fP\-\fIn\fP+1 are unset. .I n must be a non-negative number less than or equal to \fB$#\fP. If .I n is 0, no parameters are changed. If .I n is not given, it is assumed to be 1. If .I n is greater than \fB$#\fP, the positional parameters are not changed. The return status is greater than zero if .I n is greater than .B $# or less than zero; otherwise 0. .TP \fBshopt\fP [\fB\-pqsu\fP] [\fB\-o\fP] [\fIoptname\fP ...] Toggle the values of variables controlling optional shell behavior. With no options, or with the .B \-p option, a list of all settable options is displayed, with an indication of whether or not each is set. The \fB\-p\fP option causes output to be displayed in a form that may be reused as input. Other options have the following meanings: .RS .PD 0 .TP .B \-s Enable (set) each \fIoptname\fP. .TP .B \-u Disable (unset) each \fIoptname\fP. .TP .B \-q Suppresses normal output (quiet mode); the return status indicates whether the \fIoptname\fP is set or unset. If multiple \fIoptname\fP arguments are given with .BR \-q , the return status is zero if all \fIoptnames\fP are enabled; non-zero otherwise. .TP .B \-o Restricts the values of \fIoptname\fP to be those defined for the .B \-o option to the .B set builtin. .PD .PP If either .B \-s or .B \-u is used with no \fIoptname\fP arguments, the display is limited to those options which are set or unset, respectively. Unless otherwise noted, the \fBshopt\fP options are disabled (unset) by default. .PP The return status when listing options is zero if all \fIoptnames\fP are enabled, non-zero otherwise. When setting or unsetting options, the return status is zero unless an \fIoptname\fP is not a valid shell option. .PP The list of \fBshopt\fP options is: .if t .sp .5v .if n .sp 1v .PD 0 .TP 8 .B cdable_vars If set, an argument to the .B cd builtin command that is not a directory is assumed to be the name of a variable whose value is the directory to change to. .TP 8 .B cdspell If set, minor errors in the spelling of a directory component in a .B cd command will be corrected. The errors checked for are transposed characters, a missing character, and one character too many. If a correction is found, the corrected file name is printed, and the command proceeds. This option is only used by interactive shells. .TP 8 .B checkhash If set, \fBbash\fP checks that a command found in the hash table exists before trying to execute it. If a hashed command no longer exists, a normal path search is performed. .TP 8 .B checkwinsize If set, \fBbash\fP checks the window size after each command and, if necessary, updates the values of .SM .B LINES and .SM .BR COLUMNS . .TP 8 .B cmdhist If set, .B bash attempts to save all lines of a multiple-line command in the same history entry. This allows easy re-editing of multi-line commands. .TP 8 .B dotglob If set, .B bash includes filenames beginning with a `.' in the results of pathname expansion. .TP 8 .B execfail If set, a non-interactive shell will not exit if it cannot execute the file specified as an argument to the .B exec builtin command. An interactive shell does not exit if .B exec fails. .TP 8 .B expand_aliases If set, aliases are expanded as described above under .SM .BR ALIASES . This option is enabled by default for interactive shells. .TP 8 .B extglob If set, the extended pattern matching features described above under \fBPathname Expansion\fP are enabled. .TP 8 .B histappend If set, the history list is appended to the file named by the value of the .B HISTFILE variable when the shell exits, rather than overwriting the file. .TP 8 .B histreedit If set, and .B readline is being used, a user is given the opportunity to re-edit a failed history substitution. .TP 8 .B histverify If set, and .B readline is being used, the results of history substitution are not immediately passed to the shell parser. Instead, the resulting line is loaded into the \fBreadline\fP editing buffer, allowing further modification. .TP 8 .B hostcomplete If set, and .B readline is being used, \fBbash\fP will attempt to perform hostname completion when a word containing a \fB@\fP is being completed (see .B Completing under .SM .B READLINE above). This is enabled by default. .TP 8 .B huponexit If set, \fBbash\fP will send .SM .B SIGHUP to all jobs when an interactive login shell exits. .TP 8 .B interactive_comments If set, allow a word beginning with .B # to cause that word and all remaining characters on that line to be ignored in an interactive shell (see .SM .B COMMENTS above). This option is enabled by default. .TP 8 .B lithist If set, and the .B cmdhist option is enabled, multi-line commands are saved to the history with embedded newlines rather than using semicolon separators where possible. .TP 8 .B mailwarn If set, and a file that \fBbash\fP is checking for mail has been accessed since the last time it was checked, the message ``The mail in \fImailfile\fP has been read'' is displayed. .TP 8 .B nocaseglob If set, .B bash matches filenames in a case\-insensitive fashion when performing pathname expansion (see .B Pathname Expansion above). .TP 8 .B nullglob If set, .B bash allows patterns which match no files (see .B Pathname Expansion above) to expand to a null string, rather than themselves. .TP 8 .B promptvars If set, prompt strings undergo variable and parameter expansion after being expanded as described in .SM .B PROMPTING above. This option is enabled by default. .TP 8 .B restricted_shell The shell sets this option if it is started in restricted mode (see .SM .B "RESTRICTED SHELL" below). The value may not be changed. This is not reset when the startup files are executed, allowing the startup files to discover whether or not a shell is restricted. .TP 8 .B shift_verbose If set, the .B shift builtin prints an error message when the shift count exceeds the number of positional parameters. .TP 8 .B sourcepath If set, the \fBsource\fP (\fB.\fP) builtin uses the value of .SM .B PATH to find the directory containing the file supplied as an argument. This option is enabled by default. .RE .TP \fBsuspend\fP [\fB\-f\fP] Suspend the execution of this shell until it receives a .SM .B SIGCONT signal. The .B \-f option says not to complain if this is a login shell; just suspend anyway. The return status is 0 unless the shell is a login shell and .B \-f is not supplied, or if job control is not enabled. .TP .PD 0 \fBtest\fP \fIexpr\fP .TP \fB[\fP \fIexpr\fP \fB]\fP Return a status of 0 or 1 depending on the evaluation of the conditional expression .IR expr . Each operator and operand must be a separate argument. Expressions are composed of the primaries described above under .SM .BR "CONDITIONAL EXPRESSIONS" . .if t .sp 0.5 .if n .sp 1 Expressions may be combined using the following operators, listed in decreasing order of precedence. .RS .PD 0 .TP .B ! \fIexpr\fP True if .I expr is false. .TP .B ( \fIexpr\fP ) Returns the value of \fIexpr\fP. This may be used to override the normal precedence of operators. .TP \fIexpr1\fP \-\fBa\fP \fIexpr2\fP True if both .I expr1 and .I expr2 are true. .TP \fIexpr1\fP \-\fBo\fP \fIexpr2\fP True if either .I expr1 or .I expr2 is true. .PD .PP \fBtest\fP and \fB[\fP evaluate conditional expressions using a set of rules based on the number of arguments. .if t .sp 0.5 .if n .sp 1 .PD 0 .TP 0 arguments The expression is false. .TP 1 argument The expression is true if and only if the argument is not null. .TP 2 arguments If the first argument is \fB!\fP, the expression is true if and only if the second argument is null. If the first argument is one of the unary conditional operators listed above under .SM .BR "CONDITIONAL EXPRESSIONS" , the expression is true if the unary test is true. If the first argument is not a valid unary conditional operator, the expression is false. .TP 3 arguments If the second argument is one of the binary conditional operators listed above under .SM .BR "CONDITIONAL EXPRESSIONS" , the result of the expression is the result of the binary test using the first and third arguments as operands. If the first argument is \fB!\fP, the value is the negation of the two-argument test using the second and third arguments. If the first argument is exactly \fB(\fP and the third argument is exactly \fB)\fP, the result is the one-argument test of the second argument. Otherwise, the expression is false. The \fB\-a\fP and \fB\-o\fP operators are considered binary operators in this case. .TP 4 arguments If the first argument is \fB!\fP, the result is the negation of the three-argument expression composed of the remaining arguments. Otherwise, the expression is parsed and evaluated according to precedence using the rules listed above. .TP 5 or more arguments The expression is parsed and evaluated according to precedence using the rules listed above. .RE .PD .TP .B times Print the accumulated user and system times for the shell and for processes run from the shell. The return status is 0. .TP \fBtrap\fP [\fB\-lp\fP] [\fIarg\fP] [\fIsigspec\fP ...] The command .I arg is to be read and executed when the shell receives signal(s) .IR sigspec . If .I arg is absent or .BR \- , all specified signals are reset to their original values (the values they had upon entrance to the shell). If .I arg is the null string the signal specified by each .I sigspec is ignored by the shell and by the commands it invokes. If .I arg is .B \-p then the trap commands associated with each .I sigspec are displayed. If no arguments are supplied or if only .B \-p is given, .B trap prints the list of commands associated with each signal number. Each .I sigspec is either a signal name defined in <\fIsignal.h\fP>, or a signal number. If a .I sigspec is .SM .B EXIT (0) the command .I arg is executed on exit from the shell. If a .I sigspec is .SM .BR DEBUG , the command .I arg is executed after every \fIsimple command\fP (see .SM .B SHELL GRAMMAR above). The .B \-l option causes the shell to print a list of signal names and their corresponding numbers. Signals ignored upon entry to the shell cannot be trapped or reset. Trapped signals are reset to their original values in a child process when it is created. The return status is false if any .I sigspec is invalid; otherwise .B trap returns true. .TP \fBtype\fP [\fB\-atp\fP] \fIname\fP [\fIname\fP ...] With no options, indicate how each .I name would be interpreted if used as a command name. If the .B \-t option is used, .B type prints a string which is one of .IR alias , .IR keyword , .IR function , .IR builtin , or .I file if .I name is an alias, shell reserved word, function, builtin, or disk file, respectively. If the .I name is not found, then nothing is printed, and an exit status of false is returned. If the .B \-p option is used, .B type either returns the name of the disk file that would be executed if .I name were specified as a command name, or nothing if \f(CWtype -t name\fP would not return .IR file . If a command is hashed, .B \-p prints the hashed value, not necessarily the file that appears first in .SM .BR PATH . If the .B \-a option is used, .B type prints all of the places that contain an executable named .IR name . This includes aliases and functions, if and only if the .B \-p option is not also used. The table of hashed commands is not consulted when using .BR \-a . .B type returns true if any of the arguments are found, false if none are found. .TP \fBulimit\fP [\fB\-SHacdflmnpstuv\fP [\fIlimit\fP]] Provides control over the resources available to the shell and to processes started by it, on systems that allow such control. The value of .I limit can be a number in the unit specified for the resource, or the value .BR unlimited . The \fB\-H\fP and \fB\-S\fP options specify that the hard or soft limit is set for the given resource. A hard limit cannot be increased once it is set; a soft limit may be increased up to the value of the hard limit. If neither \fB\-H\fP nor \fB\-S\fP is specified, both the soft and hard limits are set. If .I limit is omitted, the current value of the soft limit of the resource is printed, unless the \fB\-H\fP option is given. When more than one resource is specified, the limit name and unit are printed before the value. Other options are interpreted as follows: .RS .PD 0 .TP .B \-a All current limits are reported .TP .B \-c The maximum size of core files created .TP .B \-d The maximum size of a process's data segment .TP .B \-f The maximum size of files created by the shell .TP .B \-l The maximum size that may be locked into memory .TP .B \-m The maximum resident set size .TP .B \-n The maximum number of open file descriptors (most systems do not allow this value to be set) .TP .B \-p The pipe size in 512-byte blocks (this may not be set) .TP .B \-s The maximum stack size .TP .B \-t The maximum amount of cpu time in seconds .TP .B \-u The maximum number of processes available to a single user .TP .B \-v The maximum amount of virtual memory available to the shell .PD .PP If .I limit is given, it is the new value of the specified resource (the .B \-a option is display only). If no option is given, then .B \-f is assumed. Values are in 1024-byte increments, except for .BR \-t , which is in seconds, .BR \-p , which is in units of 512-byte blocks, and .B \-n and .BR \-u , which are unscaled values. The return status is 0 unless an invalid option is encountered, a non-numeric argument other than \fBunlimited\fP is supplied as \fIlimit\fP, or an error occurs while setting a new limit. .RE .TP \fBumask\fP [\fB\-p\fP] [\fB\-S\fP] [\fImode\fP] The user file-creation mask is set to .IR mode . If .I mode begins with a digit, it is interpreted as an octal number; otherwise it is interpreted as a symbolic mode mask similar to that accepted by .IR chmod (1). If .I mode is omitted, or if the .B \-S option is supplied, the current value of the mask is printed. The .B \-S option causes the mask to be printed in symbolic form; the default output is an octal number. If the .B \-p option is supplied, and .I mode is omitted, the output is in a form that may be reused as input. The return status is 0 if the mode was successfully changed or if no \fImode\fP argument was supplied, and false otherwise. .TP \fBunalias\fP [\-\fBa\fP] [\fIname\fP ...] Remove \fIname\fPs from the list of defined aliases. If .B \-a is supplied, all alias definitions are removed. The return value is true unless a supplied .I name is not a defined alias. .TP \fBunset\fP [\-\fBfv\fP] [\fIname\fP ...] For each .IR name , remove the corresponding variable or function. If no options are supplied, or the .B \-v option is given, each .I name refers to a shell variable. Read-only variables may not be unset. If .B \-f is specifed, each .I name refers to a shell function, and the function definition is removed. Each unset variable or function is removed from the environment passed to subsequent commands. If any of .SM .BR RANDOM , .SM .BR SECONDS , .SM .BR LINENO , .SM .BR HISTCMD , or .SM .B DIRSTACK are unset, they lose their special properties, even if they are subsequently reset. The exit status is true unless a .I name does not exist or is readonly. .TP \fBwait\fP [\fIn\fP] Wait for the specified process and return its termination status. .I n may be a process ID or a job specification; if a job spec is given, all processes in that job's pipeline are waited for. If .I n is not given, all currently active child processes are waited for, and the return status is zero. If .I n specifies a non-existent process or job, the return status is 127. Otherwise, the return status is the exit status of the last process or job waited for. .\" bash builtins .if \n(zZ=1 .ig zZ .SH "RESTRICTED SHELL" .\" start of rbash man .zY .PP If .B bash is started with the name .BR rbash , or the .B \-r option is supplied at invocation, the shell becomes restricted. A restricted shell is used to set up an environment more controlled than the standard shell. It behaves identically to .B bash with the exception that the following are disallowed or not performed: .IP \(bu changing directories with \fBcd\fP .IP \(bu setting or unsetting the values of .BR SHELL , .BR PATH , .BR ENV , or .B BASH_ENV .IP \(bu specifying command names containing .B / .IP \(bu specifying a file name containing a .B / as an argument to the .B . builtin command .IP \(bu importing function definitions from the shell environment at startup .IP \(bu parsing the value of \fBSHELLOPTS\fP from the shell environment at startup .IP \(bu redirecting output using the >, >|, <>, >&, &>, and >> redirection operators .IP \(bu using the .B exec builtin command to replace the shell with another command .IP \(bu adding or deleting builtin commands with the .B \-f and .B \-d options to the .B enable builtin command .IP \(bu specifying the .B \-p option to the .B command builtin command .IP \(bu turning off restricted mode with \fBset +r\fP or \fBset +o restricted\fP. .PP These restrictions are enforced after any startup files are read. .PP When a command that is found to be a shell script is executed (see .SM .B "COMMAND EXECUTION" above), .B rbash turns off any restrictions in the shell spawned to execute the script. .\" end of rbash man .if \n(zY=1 .ig zY .SH "SEE ALSO" .PD 0 .TP \fIBash Features\fP, Brian Fox and Chet Ramey .TP \fIThe Gnu Readline Library\fP, Brian Fox and Chet Ramey .TP \fIThe Gnu History Library\fP, Brian Fox and Chet Ramey .TP \fIPortable Operating System Interface (POSIX) Part 2: Shell and Utilities\fP, IEEE .TP \fIsh\fP(1), \fIksh\fP(1), \fIcsh\fP(1) .TP \fIemacs\fP(1), \fIvi\fP(1) .TP \fIreadline\fP(3) .PD .SH FILES .PD 0 .TP .FN /bin/bash The \fBbash\fP executable .TP .FN /etc/profile The systemwide initialization file, executed for login shells .TP .FN ~/.bash_profile The personal initialization file, executed for login shells .TP .FN ~/.bashrc The individual per-interactive-shell startup file .TP .FN ~/.bash_logout The individual login shell cleanup file, executed when a login shell exits .TP .FN ~/.inputrc Individual \fIreadline\fP initialization file .PD .SH AUTHORS Brian Fox, Free Software Foundation .br bfox@gnu.ai.MIT.Edu .PP Chet Ramey, Case Western Reserve University .br chet@ins.CWRU.Edu .SH BUG REPORTS If you find a bug in .B bash, you should report it. But first, you should make sure that it really is a bug, and that it appears in the latest version of .B bash that you have. .PP Once you have determined that a bug actually exists, use the .I bashbug command to submit a bug report. If you have a fix, you are encouraged to mail that as well! Suggestions and `philosophical' bug reports may be mailed to \fIbug-bash@gnu.org\fP or posted to the Usenet newsgroup .BR gnu.bash.bug . .PP ALL bug reports should include: .PP .PD 0 .TP 20 The version number of \fBbash\fR .TP The hardware and operating system .TP The compiler used to compile .TP A description of the bug behaviour .TP A short script or `recipe' which exercises the bug .PD .PP .I bashbug inserts the first three items automatically into the template it provides for filing a bug report. .PP Comments and bug reports concerning this manual page should be directed to .IR chet@ins.CWRU.Edu . .SH BUGS .PP It's too big and too slow. .PP There are some subtle differences between .B bash and traditional versions of .BR sh , mostly because of the .SM .B POSIX specification. .PP Aliases are confusing in some uses. .PP Shell builtin commands and functions are not stoppable/restartable. .PP Compound commands and command sequences of the form `a ; b ; c' are not handled gracefully when process suspension is attempted. When a process is stopped, the shell immediately executes the next command in the sequence. It suffices to place the sequence of commands between parentheses to force it into a subshell, which may be stopped as a unit. .PP Commands inside of \fB$(\fP...\fB)\fP command substitution are not parsed until substitution is attempted. This will delay error reporting until some time after the command is entered. .PP Array variables may not (yet) be exported. .zZ .zY .\" Translated Fri Dec 15 09:38:56 CET 2000 by Jos Boersema .\" .SH VERTALING .\"{(language) locale -> localiteit} ok .\"{default -> normaal/standaard/'doorval'} -- .\"{script -> script} ok .\"{terminal -> terminal} ok .\"{(file name/variable)expansion -> expandering/uitlegging} ok .\"{(proces)environment -> omgeving} -- .\"{token -> voorwerp} -- .\"{redirection -> omleiden} ok .\"{string -> (karakter)string} ok .\"{optionally -> eventueel} -- .\"{status -> staat} ok .\"{mode -> mode} ok .\"{compound(command) -> gecompileerd} -- .\"{backslash -> backslash} ok .\"{backspace -> backspace} ok .\"{slash -> slag} ok .\"{'locale' -> localiteit} ok .\"{statement -> verklaring} (?) -- .\"{initialize -> initializatie} ok .\"{aray -> tabel} -- .\"{backquote -> terugaanhalingsteken, {#`#}} -- .\" .\" kopieëren ... .\" verbose/praatgraag? Dit is de handleiding van \fB bash 2.03\fR. Alles wat tussen `\fB{#\fR'..`\fB#}\fR' staat is \fBaanvullende vertaling\fR, en hoort \fBniet\fR bij de originele handleiding. Dit is anders dan de andere handleidingen omdat de tekens `{' en `}' intensief door bash gebruikt worden. Het string {# komt wel voor (tabellen,???), maar niet samen met #}. .\"CHECK DIT! als klaar .\"laat me weten als dit u niet bevalt en waarom en vooral ... hoe anders. Email naar . .\"Vertaling Jos Boersema $Id: bash.1,v 1.1 2003/04/28 18:16:31 bokkie Exp $