bash.html 334 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641
  1. <HTML><HEAD>
  2. <TITLE>BASH(1) Manual Page</TITLE>
  3. </HEAD>
  4. <BODY><TABLE WIDTH=100%>
  5. <TR>
  6. <TH ALIGN=LEFT width=33%>BASH(1)<TH ALIGN=CENTER width=33%>2016 August 26<TH ALIGN=RIGHT width=33%>BASH(1)
  7. </TR>
  8. </TABLE>
  9. <BR><A HREF="#index">Index</A>
  10. <HR>
  11. <A NAME="lbAB">&nbsp;</A>
  12. <H3>NAME</H3>
  13. bash - GNU Bourne-Again SHell
  14. <A NAME="lbAC">&nbsp;</A>
  15. <H3>SYNOPSIS</H3>
  16. <B>bash</B>
  17. [options]
  18. [command_string | file]
  19. <A NAME="lbAD">&nbsp;</A>
  20. <H3>COPYRIGHT</H3>
  21. Bash is Copyright &#169; 1989-2016 by the Free Software Foundation, Inc.
  22. <A NAME="lbAE">&nbsp;</A>
  23. <H3>DESCRIPTION</H3>
  24. <B>Bash</B>
  25. is an <B>sh</B>-compatible command language interpreter that
  26. executes commands read from the standard input or from a file.
  27. <B>Bash</B>
  28. also incorporates useful features from the <I>Korn</I> and <I>C</I>
  29. shells (<B>ksh</B> and <B>csh</B>).
  30. <P>
  31. <B>Bash</B>
  32. is intended to be a conformant implementation of the
  33. Shell and Utilities portion of the IEEE POSIX specification
  34. (IEEE Standard 1003.1).
  35. <B>Bash</B>
  36. can be configured to be POSIX-conformant by default.
  37. <A NAME="lbAF">&nbsp;</A>
  38. <H3>OPTIONS</H3>
  39. All of the single-character shell options documented in the
  40. description of the <B>set</B> builtin command can be used as options
  41. when the shell is invoked.
  42. In addition, <B>bash</B>
  43. interprets the following options when it is invoked:
  44. <P>
  45. <DL COMPACT>
  46. <DT><B>-c</B>
  47. <DD>
  48. If the
  49. <B>-c</B>
  50. option is present, then commands are read from the first non-option argument
  51. <I>command_string</I>.
  52. If there are arguments after the
  53. <I>command_string</I>,
  54. the first argument is assigned to
  55. <B>$0</B>
  56. and any remaining arguments are assigned to the positional parameters.
  57. The assignment to
  58. <B>$0</B>
  59. sets the name of the shell, which is used in warning and error messages.
  60. <DT><B>-i</B>
  61. <DD>
  62. If the
  63. <B>-i</B>
  64. option is present, the shell is
  65. <I>interactive</I>.
  66. <DT><B>-l</B>
  67. <DD>
  68. Make
  69. <B>bash</B>
  70. act as if it had been invoked as a login shell (see
  71. <FONT SIZE=-1><B>INVOCATION</B>
  72. </FONT>
  73. below).
  74. <DT><B>-r</B>
  75. <DD>
  76. If the
  77. <B>-r</B>
  78. option is present, the shell becomes
  79. <I>restricted</I>
  80. (see
  81. <FONT SIZE=-1><B>RESTRICTED SHELL</B>
  82. </FONT>
  83. below).
  84. <DT><B>-s</B>
  85. <DD>
  86. If the
  87. <B>-s</B>
  88. option is present, or if no arguments remain after option
  89. processing, then commands are read from the standard input.
  90. This option allows the positional parameters to be set
  91. when invoking an interactive shell.
  92. <DT><B>-D</B>
  93. <DD>
  94. A list of all double-quoted strings preceded by <B>$</B>
  95. is printed on the standard output.
  96. These are the strings that
  97. are subject to language translation when the current locale
  98. is not <B>C</B> or <B>POSIX</B>.
  99. This implies the <B>-n</B> option; no commands will be executed.
  100. <DT><B>[-+]O [</B><I>shopt_option</I>]
  101. <DD>
  102. <I>shopt_option</I> is one of the shell options accepted by the
  103. <B>shopt</B> builtin (see
  104. <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
  105. </FONT>
  106. below).
  107. If <I>shopt_option</I> is present, <B>-O</B> sets the value of that option;
  108. <B>+O</B> unsets it.
  109. If <I>shopt_option</I> is not supplied, the names and values of the shell
  110. options accepted by <B>shopt</B> are printed on the standard output.
  111. If the invocation option is <B>+O</B>, the output is displayed in a format
  112. that may be reused as input.
  113. <DT><B>--</B>
  114. <DD>
  115. A
  116. <B>--</B>
  117. signals the end of options and disables further option processing.
  118. Any arguments after the
  119. <B>--</B>
  120. are treated as filenames and arguments. An argument of
  121. <B>-</B>
  122. is equivalent to <B>--</B>.
  123. </DL>
  124. <P>
  125. <B>Bash</B>
  126. also interprets a number of multi-character options.
  127. These options must appear on the command line before the
  128. single-character options to be recognized.
  129. <P>
  130. <DL COMPACT>
  131. <DT><B>--debugger</B>
  132. <DD>
  133. Arrange for the debugger profile to be executed before the shell
  134. starts.
  135. Turns on extended debugging mode (see the description of the
  136. <B>extdebug</B>
  137. option to the
  138. <B>shopt</B>
  139. builtin below).
  140. <DT><B>--dump-po-strings</B>
  141. <DD>
  142. Equivalent to <B>-D</B>, but the output is in the GNU <I>gettext</I>
  143. <B>po</B> (portable object) file format.
  144. <DT><B>--dump-strings</B>
  145. <DD>
  146. Equivalent to <B>-D</B>.
  147. <DT><B>--help</B>
  148. <DD>
  149. Display a usage message on standard output and exit successfully.
  150. <DT><B>--init-file</B> <I>file</I><DD>
  151. <DT><B>--rcfile</B> <I>file</I><DD>
  152. Execute commands from
  153. <I>file</I>
  154. instead of the standard personal initialization file
  155. <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>
  156. if the shell is interactive (see
  157. <FONT SIZE=-1><B>INVOCATION</B>
  158. </FONT>
  159. below).
  160. <DT><B>--login</B>
  161. <DD>
  162. Equivalent to <B>-l</B>.
  163. <DT><B>--noediting</B>
  164. <DD>
  165. Do not use the GNU
  166. <B>readline</B>
  167. library to read command lines when the shell is interactive.
  168. <DT><B>--noprofile</B>
  169. <DD>
  170. Do not read either the system-wide startup file
  171. <A HREF="file:/etc/profile"><I>/etc/profile</I></A>
  172. or any of the personal initialization files
  173. <A HREF="file:~/.bash_profile"><I>~/.bash_profile</I></A>,
  174. <A HREF="file:~/.bash_login"><I>~/.bash_login</I></A>,
  175. or
  176. <A HREF="file:~/.profile"><I>~/.profile</I></A>.
  177. By default,
  178. <B>bash</B>
  179. reads these files when it is invoked as a login shell (see
  180. <FONT SIZE=-1><B>INVOCATION</B>
  181. </FONT>
  182. below).
  183. <DT><B>--norc</B>
  184. <DD>
  185. Do not read and execute the personal initialization file
  186. <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>
  187. if the shell is interactive.
  188. This option is on by default if the shell is invoked as
  189. <B>sh</B>.
  190. <DT><B>--posix</B>
  191. <DD>
  192. Change the behavior of <B>bash</B> where the default operation differs
  193. from the POSIX standard to match the standard (<I>posix mode</I>).
  194. See
  195. <FONT SIZE=-1><B>SEE ALSO</B>
  196. </FONT>
  197. below for a reference to a document that details how posix mode affects
  198. bash's behavior.
  199. <DT><B>--restricted</B>
  200. <DD>
  201. The shell becomes restricted (see
  202. <FONT SIZE=-1><B>RESTRICTED SHELL</B>
  203. </FONT>
  204. below).
  205. <DT><B>--verbose</B>
  206. <DD>
  207. Equivalent to <B>-v</B>.
  208. <DT><B>--version</B>
  209. <DD>
  210. Show version information for this instance of
  211. <B>bash</B>
  212. on the standard output and exit successfully.
  213. </DL>
  214. <A NAME="lbAG">&nbsp;</A>
  215. <H3>ARGUMENTS</H3>
  216. If arguments remain after option processing, and neither the
  217. <B>-c</B>
  218. nor the
  219. <B>-s</B>
  220. option has been supplied, the first argument is assumed to
  221. be the name of a file containing shell commands.
  222. If
  223. <B>bash</B>
  224. is invoked in this fashion,
  225. <B>$0</B>
  226. is set to the name of the file, and the positional parameters
  227. are set to the remaining arguments.
  228. <B>Bash</B>
  229. reads and executes commands from this file, then exits.
  230. <B>Bash</B>'s exit status is the exit status of the last command
  231. executed in the script.
  232. If no commands are executed, the exit status is 0.
  233. An attempt is first made to open the file in the current directory, and,
  234. if no file is found, then the shell searches the directories in
  235. <FONT SIZE=-1><B>PATH</B>
  236. </FONT>
  237. for the script.
  238. <A NAME="lbAH">&nbsp;</A>
  239. <H3>INVOCATION</H3>
  240. A <I>login shell</I> is one whose first character of argument zero is a
  241. <B>-</B>,
  242. or one started with the
  243. <B>--login</B>
  244. option.
  245. <P>
  246. An <I>interactive</I> shell is one started without non-option arguments
  247. (unless <B>-s</B> is specified)
  248. and without the
  249. <B>-c</B>
  250. option
  251. whose standard input and error are
  252. both connected to terminals (as determined by
  253. <I>isatty</I>(3)),
  254. or one started with the
  255. <B>-i</B>
  256. option.
  257. <FONT SIZE=-1><B>PS1</B>
  258. </FONT>
  259. is set and
  260. <B>$-</B>
  261. includes
  262. <B>i</B>
  263. if
  264. <B>bash</B>
  265. is interactive,
  266. allowing a shell script or a startup file to test this state.
  267. <P>
  268. The following paragraphs describe how
  269. <B>bash</B>
  270. executes its startup files.
  271. If any of the files exist but cannot be read,
  272. <B>bash</B>
  273. reports an error.
  274. Tildes are expanded in filenames as described below under
  275. <B>Tilde Expansion</B>
  276. in the
  277. <FONT SIZE=-1><B>EXPANSION</B>
  278. </FONT>
  279. section.
  280. <P>
  281. When
  282. <B>bash</B>
  283. is invoked as an interactive login shell, or as a non-interactive shell
  284. with the <B>--login</B> option, it first reads and
  285. executes commands from the file <A HREF="file:/etc/profile"><I>/etc/profile</I></A>, if that
  286. file exists.
  287. After reading that file, it looks for <A HREF="file:~/.bash_profile"><I>~/.bash_profile</I></A>,
  288. <A HREF="file:~/.bash_login"><I>~/.bash_login</I></A>, and <A HREF="file:~/.profile"><I>~/.profile</I></A>, in that order, and reads
  289. and executes commands from the first one that exists and is readable.
  290. The
  291. <B>--noprofile</B>
  292. option may be used when the shell is started to inhibit this behavior.
  293. <P>
  294. When an interactive login shell exits,
  295. or a non-interactive login shell executes the <B>exit</B> builtin command,
  296. <B>bash</B>
  297. reads and executes commands from the file <A HREF="file:~/.bash_logout"><I>~/.bash_logout</I></A>, if it
  298. exists.
  299. <P>
  300. When an interactive shell that is not a login shell is started,
  301. <B>bash</B>
  302. reads and executes commands from <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>, if that file exists.
  303. This may be inhibited by using the
  304. <B>--norc</B>
  305. option.
  306. The <B>--rcfile</B> <I>file</I> option will force
  307. <B>bash</B>
  308. to read and execute commands from <I>file</I> instead of <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>.
  309. <P>
  310. When
  311. <B>bash</B>
  312. is started non-interactively, to run a shell script, for example, it
  313. looks for the variable
  314. <FONT SIZE=-1><B>BASH_ENV</B>
  315. </FONT>
  316. in the environment, expands its value if it appears there, and uses the
  317. expanded value as the name of a file to read and execute.
  318. <B>Bash</B>
  319. behaves as if the following command were executed:
  320. <P>
  321. <DL COMPACT><DT><DD>
  322. <TT>if [ -n &quot;$BASH_ENV&quot; ]; then . &quot;$BASH_ENV&quot;; fi</TT>
  323. </DL>
  324. <P>
  325. but the value of the
  326. <FONT SIZE=-1><B>PATH</B>
  327. </FONT>
  328. variable is not used to search for the filename.
  329. <P>
  330. If
  331. <B>bash</B>
  332. is invoked with the name
  333. <B>sh</B>,
  334. it tries to mimic the startup behavior of historical versions of
  335. <B>sh</B>
  336. as closely as possible,
  337. while conforming to the POSIX standard as well.
  338. When invoked as an interactive login shell, or a non-interactive
  339. shell with the <B>--login</B> option, it first attempts to
  340. read and execute commands from
  341. <A HREF="file:/etc/profile"><I>/etc/profile</I></A>
  342. and
  343. <A HREF="file:~/.profile"><I>~/.profile</I></A>,
  344. in that order.
  345. The
  346. <B>--noprofile</B>
  347. option may be used to inhibit this behavior.
  348. When invoked as an interactive shell with the name
  349. <B>sh</B>,
  350. <B>bash</B>
  351. looks for the variable
  352. <FONT SIZE=-1><B>ENV</B>,
  353. </FONT>
  354. expands its value if it is defined, and uses the
  355. expanded value as the name of a file to read and execute.
  356. Since a shell invoked as
  357. <B>sh</B>
  358. does not attempt to read and execute commands from any other startup
  359. files, the
  360. <B>--rcfile</B>
  361. option has no effect.
  362. A non-interactive shell invoked with the name
  363. <B>sh</B>
  364. does not attempt to read any other startup files.
  365. When invoked as
  366. <B>sh</B>,
  367. <B>bash</B>
  368. enters
  369. <I>posix</I>
  370. mode after the startup files are read.
  371. <P>
  372. When
  373. <B>bash</B>
  374. is started in
  375. <I>posix</I>
  376. mode, as with the
  377. <B>--posix</B>
  378. command line option, it follows the POSIX standard for startup files.
  379. In this mode, interactive shells expand the
  380. <FONT SIZE=-1><B>ENV</B>
  381. </FONT>
  382. variable and commands are read and executed from the file
  383. whose name is the expanded value.
  384. No other startup files are read.
  385. <P>
  386. <B>Bash</B>
  387. attempts to determine when it is being run with its standard input
  388. connected to a network connection, as when executed by the remote shell
  389. daemon, usually <I>rshd</I>, or the secure shell daemon <I>sshd</I>.
  390. If
  391. <B>bash</B>
  392. determines it is being run in this fashion, it reads and executes
  393. commands from <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>, if that file exists and is readable.
  394. It will not do this if invoked as <B>sh</B>.
  395. The
  396. <B>--norc</B>
  397. option may be used to inhibit this behavior, and the
  398. <B>--rcfile</B>
  399. option may be used to force another file to be read, but neither
  400. <I>rshd</I> nor <I>sshd</I> generally invoke the shell with those options
  401. or allow them to be specified.
  402. <P>
  403. If the shell is started with the effective user (group) id not equal to the
  404. real user (group) id, and the <B>-p</B> option is not supplied, no startup
  405. files are read, shell functions are not inherited from the environment, the
  406. <FONT SIZE=-1><B>SHELLOPTS</B>,
  407. </FONT>
  408. <FONT SIZE=-1><B>BASHOPTS</B>,
  409. </FONT>
  410. <FONT SIZE=-1><B>CDPATH</B>,
  411. </FONT>
  412. and
  413. <FONT SIZE=-1><B>GLOBIGNORE</B>
  414. </FONT>
  415. variables, if they appear in the environment, are ignored,
  416. and the effective user id is set to the real user id.
  417. If the <B>-p</B> option is supplied at invocation, the startup behavior is
  418. the same, but the effective user id is not reset.
  419. <A NAME="lbAI">&nbsp;</A>
  420. <H3>DEFINITIONS</H3>
  421. <P>
  422. The following definitions are used throughout the rest of this
  423. document.
  424. <DL COMPACT>
  425. <DT><B>blank</B>
  426. <DD>
  427. A space or tab.
  428. <DT><B>word</B>
  429. <DD>
  430. A sequence of characters considered as a single unit by the shell.
  431. Also known as a
  432. <B>token</B>.
  433. <DT><B>name</B>
  434. <DD>
  435. A
  436. <I>word</I>
  437. consisting only of alphanumeric characters and underscores, and
  438. beginning with an alphabetic character or an underscore. Also
  439. referred to as an
  440. <B>identifier</B>.
  441. <DT><B>metacharacter</B>
  442. <DD>
  443. A character that, when unquoted, separates words. One of the following:
  444. <BR>
  445. <DL COMPACT><DT><DD>
  446. <P>
  447. <B>| &amp; ; ( ) &lt; &gt; space tab newline</B>
  448. </DL>
  449. </DL>
  450. <P>
  451. <DL COMPACT>
  452. <DT><B>control operator</B>
  453. <DD>
  454. A <I>token</I> that performs a control function. It is one of the following
  455. symbols:
  456. <DL COMPACT><DT><DD>
  457. <P>
  458. <B>|| &amp; &amp;&amp; ; ;; ;&amp; ;;&amp; ( ) | |&amp; &lt;newline&gt;</B>
  459. </DL>
  460. </DL>
  461. <A NAME="lbAJ">&nbsp;</A>
  462. <H3>RESERVED WORDS</H3>
  463. <I>Reserved words</I> are words that have a special meaning to the shell.
  464. The following words are recognized as reserved when unquoted and either
  465. the first word of a simple command (see
  466. <FONT SIZE=-1><B>SHELL GRAMMAR</B>
  467. </FONT>
  468. below) or the third word of a
  469. <B>case</B>
  470. or
  471. <B>for</B>
  472. command:
  473. <DL COMPACT><DT><DD>
  474. <P>
  475. <B>
  476. </B>
  477. ! case coproc do done elif else esac fi for function if in select then until while { } time [[ ]]
  478. </DL>
  479. <A NAME="lbAK">&nbsp;</A>
  480. <H3>SHELL GRAMMAR</H3>
  481. <A NAME="lbAL">&nbsp;</A>
  482. <H4>Simple Commands</H4>
  483. <P>
  484. A <I>simple command</I> is a sequence of optional variable assignments
  485. followed by <B>blank</B>-separated words and redirections, and
  486. terminated by a <I>control operator</I>. The first word
  487. specifies the command to be executed, and is passed as argument zero.
  488. The remaining words are passed as arguments to the invoked command.
  489. <P>
  490. The return value of a <I>simple command</I> is its exit status, or
  491. 128+<I>n</I> if the command is terminated by signal
  492. <I>n</I>.
  493. <A NAME="lbAM">&nbsp;</A>
  494. <H4>Pipelines</H4>
  495. <P>
  496. A <I>pipeline</I> is a sequence of one or more commands separated by
  497. one of the control operators
  498. <B>|</B>
  499. or <B>|&amp;</B>.
  500. The format for a pipeline is:
  501. <DL COMPACT><DT><DD>
  502. <P>
  503. [<B>time</B> [<B>-p</B>]] [ ! ] <I>command</I> [ [<B>|</B>|<B>|&amp;</B>] <I>command2</I> ... ]
  504. </DL>
  505. <P>
  506. The standard output of
  507. <I>command</I>
  508. is connected via a pipe to the standard input of
  509. <I>command2</I>.
  510. This connection is performed before any redirections specified by the
  511. command (see
  512. <FONT SIZE=-1><B>REDIRECTION</B>
  513. </FONT>
  514. below).
  515. If <B>|&amp;</B> is used, <I>command</I>'s standard error, in addition to its
  516. standard output, is connected to
  517. <I>command2</I>'s standard input through the pipe;
  518. it is shorthand for <B>2&gt;&amp;1 |</B>.
  519. This implicit redirection of the standard error to the standard output is
  520. performed after any redirections specified by the command.
  521. <P>
  522. The return status of a pipeline is the exit status of the last
  523. command, unless the <B>pipefail</B> option is enabled.
  524. If <B>pipefail</B> is enabled, the pipeline's return status is the
  525. value of the last (rightmost) command to exit with a non-zero status,
  526. or zero if all commands exit successfully.
  527. If the reserved word
  528. <B>!</B>
  529. precedes a pipeline, the exit status of that pipeline is the logical
  530. negation of the exit status as described above.
  531. The shell waits for all commands in the pipeline to
  532. terminate before returning a value.
  533. <P>
  534. If the
  535. <B>time</B>
  536. reserved word precedes a pipeline, the elapsed as well as user and
  537. system time consumed by its execution are reported when the pipeline
  538. terminates.
  539. The <B>-p</B> option changes the output format to that specified by POSIX.
  540. When the shell is in <I>posix mode</I>, it does not recognize
  541. <B>time</B> as a reserved word if the next token begins with a `-'.
  542. The
  543. <FONT SIZE=-1><B>TIMEFORMAT</B>
  544. </FONT>
  545. variable may be set to a format string that specifies how the timing
  546. information should be displayed; see the description of
  547. <FONT SIZE=-1><B>TIMEFORMAT</B>
  548. </FONT>
  549. under
  550. <B>Shell Variables</B>
  551. below.
  552. <P>
  553. When the shell is in <I>posix mode</I>, <B>time</B>
  554. may be followed by a newline. In this case, the shell displays the
  555. total user and system time consumed by the shell and its children.
  556. The
  557. <FONT SIZE=-1><B>TIMEFORMAT</B>
  558. </FONT>
  559. variable may be used to specify the format of
  560. the time information.
  561. <P>
  562. Each command in a pipeline is executed as a separate process (i.e., in a
  563. subshell).
  564. <A NAME="lbAN">&nbsp;</A>
  565. <H4>Lists</H4>
  566. <P>
  567. A <I>list</I> is a sequence of one or more pipelines separated by one
  568. of the operators
  569. <B>;</B>,
  570. <B>&amp;</B>,
  571. <B>&amp;&amp;</B>,
  572. or
  573. <B>||</B>,
  574. and optionally terminated by one of
  575. <B>;</B>,
  576. <B>&amp;</B>,
  577. or
  578. <B>&lt;newline&gt;</B>.
  579. <P>
  580. Of these list operators,
  581. <B>&amp;&amp;</B>
  582. and
  583. <B>||</B>
  584. have equal precedence, followed by
  585. <B>;</B>
  586. and
  587. <B>&amp;</B>,
  588. which have equal precedence.
  589. <P>
  590. A sequence of one or more newlines may appear in a <I>list</I> instead
  591. of a semicolon to delimit commands.
  592. <P>
  593. If a command is terminated by the control operator
  594. <B>&amp;</B>,
  595. the shell executes the command in the <I>background</I>
  596. in a subshell. The shell does not wait for the command to
  597. finish, and the return status is 0. Commands separated by a
  598. <B>;</B>
  599. are executed sequentially; the shell waits for each
  600. command to terminate in turn. The return status is the
  601. exit status of the last command executed.
  602. <P>
  603. AND and OR lists are sequences of one or more pipelines separated by the
  604. <B>&amp;&amp;</B> and <B>||</B> control operators, respectively.
  605. AND and OR lists are executed with left associativity.
  606. An AND list has the form
  607. <DL COMPACT><DT><DD>
  608. <P>
  609. <I>command1</I> <B>&amp;&amp;</B> <I>command2</I>
  610. </DL>
  611. <P>
  612. <I>command2</I>
  613. is executed if, and only if,
  614. <I>command1</I>
  615. returns an exit status of zero.
  616. <P>
  617. An OR list has the form
  618. <DL COMPACT><DT><DD>
  619. <P>
  620. <I>command1</I> <B>||</B> <I>command2</I>
  621. <P>
  622. </DL>
  623. <P>
  624. <I>command2</I>
  625. is executed if and only if
  626. <I>command1</I>
  627. returns a non-zero exit status.
  628. The return status of
  629. AND and OR lists is the exit status of the last command
  630. executed in the list.
  631. <A NAME="lbAO">&nbsp;</A>
  632. <H4>Compound Commands</H4>
  633. <P>
  634. A <I>compound command</I> is one of the following.
  635. In most cases a <I>list</I> in a command's description may be separated from
  636. the rest of the command by one or more newlines, and may be followed by a
  637. newline in place of a semicolon.
  638. <DL COMPACT>
  639. <DT>(<I>list</I>)<DD>
  640. <I>list</I> is executed in a subshell environment (see
  641. <FONT SIZE=-1><B>COMMAND EXECUTION ENVIRONMENT</B></FONT>
  642. below).
  643. Variable assignments and builtin
  644. commands that affect the shell's environment do not remain in effect
  645. after the command completes. The return status is the exit status of
  646. <I>list</I>.
  647. <DT>{ <I>list</I>; }<DD>
  648. <I>list</I> is simply executed in the current shell environment.
  649. <I>list</I> must be terminated with a newline or semicolon.
  650. This is known as a <I>group command</I>.
  651. The return status is the exit status of
  652. <I>list</I>.
  653. Note that unlike the metacharacters <B>(</B> and <B>)</B>, <B>{</B> and
  654. <B>}</B> are <I>reserved words</I> and must occur where a reserved
  655. word is permitted to be recognized. Since they do not cause a word
  656. break, they must be separated from <I>list</I> by whitespace or another
  657. shell metacharacter.
  658. <DT>((<I>expression</I>))<DD>
  659. The <I>expression</I> is evaluated according to the rules described
  660. below under
  661. <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>.
  662. </FONT>
  663. If the value of the expression is non-zero, the return status is 0;
  664. otherwise the return status is 1. This is exactly equivalent to
  665. <B>let &quot;</B><I>expression</I>&quot;.
  666. <DT><B>[[</B> <I>expression</I> <B>]]</B><DD>
  667. Return a status of 0 or 1 depending on the evaluation of
  668. the conditional expression <I>expression</I>.
  669. Expressions are composed of the primaries described below under
  670. <FONT SIZE=-1><B>CONDITIONAL EXPRESSIONS</B>.
  671. </FONT>
  672. Word splitting and pathname expansion are not performed on the words
  673. between the <B>[[</B> and <B>]]</B>; tilde expansion,
  674. parameter and variable expansion,
  675. arithmetic expansion, command substitution, process
  676. substitution, and quote removal are performed.
  677. Conditional operators such as <B>-f</B> must be unquoted to be recognized
  678. as primaries.
  679. <P>
  680. When used with <B>[[</B>, the <B>&lt;</B> and <B>&gt;</B> operators sort
  681. lexicographically using the current locale.
  682. <P>
  683. When the <B>==</B> and <B>!=</B> operators are used, the string to the
  684. right of the operator is considered a pattern and matched according
  685. to the rules described below under <B>Pattern Matching</B>,
  686. as if the <B>extglob</B> shell option were enabled.
  687. The <B>=</B> operator is equivalent to <B>==</B>.
  688. If the
  689. <B>nocasematch</B>
  690. shell option is enabled, the match is performed without regard to the case
  691. of alphabetic characters.
  692. The return value is 0 if the string matches (<B>==</B>) or does not match
  693. (<B>!=</B>) the pattern, and 1 otherwise.
  694. Any part of the pattern may be quoted to force the quoted portion
  695. to be matched as a string.
  696. <P>
  697. An additional binary operator, <B>=~</B>, is available, with the same
  698. precedence as <B>==</B> and <B>!=</B>.
  699. When it is used, the string to the right of the operator is considered
  700. an extended regular expression and matched accordingly (as in <I>regex</I>(3)).
  701. The return value is 0 if the string matches
  702. the pattern, and 1 otherwise.
  703. If the regular expression is syntactically incorrect, the conditional
  704. expression's return value is 2.
  705. If the
  706. <B>nocasematch</B>
  707. shell option is enabled, the match is performed without regard to the case
  708. of alphabetic characters.
  709. Any part of the pattern may be quoted to force the quoted portion
  710. to be matched as a string.
  711. Bracket expressions in regular expressions must be treated carefully,
  712. since normal quoting characters lose their meanings between brackets.
  713. If the pattern is stored in a shell variable, quoting the variable
  714. expansion forces the entire pattern to be matched as a string.
  715. Substrings matched by parenthesized subexpressions within the regular
  716. expression are saved in the array variable
  717. <FONT SIZE=-1><B>BASH_REMATCH</B>.
  718. </FONT>
  719. The element of
  720. <FONT SIZE=-1><B>BASH_REMATCH</B>
  721. </FONT>
  722. with index 0 is the portion of the string
  723. matching the entire regular expression.
  724. The element of
  725. <FONT SIZE=-1><B>BASH_REMATCH</B>
  726. </FONT>
  727. with index <I>n</I> is the portion of the
  728. string matching the <I>n</I>th parenthesized subexpression.
  729. <P>
  730. Expressions may be combined using the following operators, listed
  731. in decreasing order of precedence:
  732. <P>
  733. <DL COMPACT><DT><DD>
  734. <DL COMPACT>
  735. <DT><B>( </B><I>expression</I> )
  736. <DD>
  737. Returns the value of <I>expression</I>.
  738. This may be used to override the normal precedence of operators.
  739. <DT><B>! </B><I>expression</I>
  740. <DD>
  741. True if
  742. <I>expression</I>
  743. is false.
  744. <DT><I>expression1</I> <B>&amp;&amp;</B> <I>expression2</I><DD>
  745. True if both
  746. <I>expression1</I>
  747. and
  748. <I>expression2</I>
  749. are true.
  750. <DT><I>expression1</I> <B>||</B> <I>expression2</I><DD>
  751. True if either
  752. <I>expression1</I>
  753. or
  754. <I>expression2</I>
  755. is true.
  756. </DL>
  757. <P>
  758. The <B>&amp;&amp;</B> and <B>||</B>
  759. operators do not evaluate <I>expression2</I> if the value of
  760. <I>expression1</I> is sufficient to determine the return value of
  761. the entire conditional expression.
  762. </DL>
  763. <DT><B>for</B> <I>name</I> [ [ <B>in</B> [ <I>word ...</I> ] ] ; ] <B>do</B> <I>list</I> ; <B>done</B><DD>
  764. The list of words following <B>in</B> is expanded, generating a list
  765. of items.
  766. The variable <I>name</I> is set to each element of this list
  767. in turn, and <I>list</I> is executed each time.
  768. If the <B>in</B> <I>word</I> is omitted, the <B>for</B> command executes
  769. <I>list</I> once for each positional parameter that is set (see
  770. <FONT SIZE=-1><B>PARAMETERS</B>
  771. </FONT>
  772. below).
  773. The return status is the exit status of the last command that executes.
  774. If the expansion of the items following <B>in</B> results in an empty
  775. list, no commands are executed, and the return status is 0.
  776. <DT><B>for</B> (( <I>expr1</I> ; <I>expr2</I> ; <I>expr3</I> )) ; <B>do</B> <I>list</I> ; <B>done</B><DD>
  777. First, the arithmetic expression <I>expr1</I> is evaluated according
  778. to the rules described below under
  779. <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>.
  780. </FONT>
  781. The arithmetic expression <I>expr2</I> is then evaluated repeatedly
  782. until it evaluates to zero.
  783. Each time <I>expr2</I> evaluates to a non-zero value, <I>list</I> is
  784. executed and the arithmetic expression <I>expr3</I> is evaluated.
  785. If any expression is omitted, it behaves as if it evaluates to 1.
  786. The return value is the exit status of the last command in <I>list</I>
  787. that is executed, or false if any of the expressions is invalid.
  788. <DT><B>select</B> <I>name</I> [ <B>in</B> <I>word</I> ] ; <B>do</B> <I>list</I> ; <B>done</B><DD>
  789. The list of words following <B>in</B> is expanded, generating a list
  790. of items. The set of expanded words is printed on the standard
  791. error, each preceded by a number. If the <B>in</B>
  792. <I>word</I> is omitted, the positional parameters are printed (see
  793. <FONT SIZE=-1><B>PARAMETERS</B>
  794. </FONT>
  795. below). The
  796. <FONT SIZE=-1><B>PS3</B>
  797. </FONT>
  798. prompt is then displayed and a line read from the standard input.
  799. If the line consists of a number corresponding to one of
  800. the displayed words, then the value of
  801. <I>name</I>
  802. is set to that word. If the line is empty, the words and prompt
  803. are displayed again. If EOF is read, the command completes. Any
  804. other value read causes
  805. <I>name</I>
  806. to be set to null. The line read is saved in the variable
  807. <FONT SIZE=-1><B>REPLY</B>.
  808. </FONT>
  809. The
  810. <I>list</I>
  811. is executed after each selection until a
  812. <B>break</B>
  813. command is executed.
  814. The exit status of
  815. <B>select</B>
  816. is the exit status of the last command executed in
  817. <I>list</I>,
  818. or zero if no commands were executed.
  819. <DT><B>case</B> <I>word</I> <B>in</B> [ [(] <I>pattern</I> [ <B>|</B> <I>pattern</I> ]
  820. <DD>
  821. A <B>case</B> command first expands <I>word</I>, and tries to match
  822. it against each <I>pattern</I> in turn, using the same matching rules
  823. as for pathname expansion (see
  824. <B>Pathname Expansion</B>
  825. below).
  826. The <I>word</I> is expanded using tilde
  827. expansion, parameter and variable expansion, arithmetic expansion,
  828. command substitution, process substitution and quote removal.
  829. Each <I>pattern</I> examined is expanded using tilde
  830. expansion, parameter and variable expansion, arithmetic expansion,
  831. command substitution, and process substitution.
  832. If the
  833. <B>nocasematch</B>
  834. shell option is enabled, the match is performed without regard to the case
  835. of alphabetic characters.
  836. When a match is found, the corresponding <I>list</I> is executed.
  837. If the <B>;;</B> operator is used, no subsequent matches are attempted after
  838. the first pattern match.
  839. Using <B>;&amp;</B> in place of <B>;;</B> causes execution to continue with
  840. the <I>list</I> associated with the next set of patterns.
  841. Using <B>;;&amp;</B> in place of <B>;;</B> causes the shell to test the next
  842. pattern list in the statement, if any, and execute any associated <I>list</I>
  843. on a successful match.
  844. The exit status is zero if no
  845. pattern matches. Otherwise, it is the exit status of the
  846. last command executed in <I>list</I>.
  847. <DT><B>if</B> <I>list</I>; <B>then</B> <I>list</I>; [ <B>elif</B> <I>list</I>; <B>then</B> <I>list</I>; ] ... [ <B>else</B> <I>list</I>; ] <B>fi</B><DD>
  848. The
  849. <B>if</B>
  850. <I>list</I>
  851. is executed. If its exit status is zero, the
  852. <B>then</B> <I>list</I> is executed. Otherwise, each <B>elif</B>
  853. <I>list</I> is executed in turn, and if its exit status is zero,
  854. the corresponding <B>then</B> <I>list</I> is executed and the
  855. command completes. Otherwise, the <B>else</B> <I>list</I> is
  856. executed, if present. The exit status is the exit status of the
  857. last command executed, or zero if no condition tested true.
  858. <DT><B>while</B> <I>list-1</I>; <B>do</B> <I>list-2</I>; <B>done</B><DD>
  859. <DT><B>until</B> <I>list-1</I>; <B>do</B> <I>list-2</I>; <B>done</B><DD>
  860. The <B>while</B> command continuously executes the list
  861. <I>list-2</I> as long as the last command in the list <I>list-1</I> returns
  862. an exit status of zero. The <B>until</B> command is identical
  863. to the <B>while</B> command, except that the test is negated:
  864. <I>list-2</I>
  865. is executed as long as the last command in
  866. <I>list-1</I>
  867. returns a non-zero exit status.
  868. The exit status of the <B>while</B> and <B>until</B> commands
  869. is the exit status
  870. of the last command executed in <I>list-2</I>, or zero if
  871. none was executed.
  872. </DL>
  873. <A NAME="lbAP">&nbsp;</A>
  874. <H4>Coprocesses</H4>
  875. <P>
  876. A <I>coprocess</I> is a shell command preceded by the <B>coproc</B> reserved
  877. word.
  878. A coprocess is executed asynchronously in a subshell, as if the command
  879. had been terminated with the <B>&amp;</B> control operator, with a two-way pipe
  880. established between the executing shell and the coprocess.
  881. <P>
  882. The format for a coprocess is:
  883. <DL COMPACT><DT><DD>
  884. <P>
  885. <B>coproc</B> [<I>NAME</I>] <I>command</I> [<I>redirections</I>]
  886. </DL>
  887. <P>
  888. This creates a coprocess named <I>NAME</I>.
  889. If <I>NAME</I> is not supplied, the default name is <B>COPROC</B>.
  890. <I>NAME</I> must not be supplied if <I>command</I> is a <I>simple
  891. command</I> (see above); otherwise, it is interpreted as the first word
  892. of the simple command.
  893. When the coprocess is executed, the shell creates an array variable (see
  894. <B>Arrays</B>
  895. below) named <I>NAME</I> in the context of the executing shell.
  896. The standard output of
  897. <I>command</I>
  898. is connected via a pipe to a file descriptor in the executing shell,
  899. and that file descriptor is assigned to <I>NAME</I>[0].
  900. The standard input of
  901. <I>command</I>
  902. is connected via a pipe to a file descriptor in the executing shell,
  903. and that file descriptor is assigned to <I>NAME</I>[1].
  904. This pipe is established before any redirections specified by the
  905. command (see
  906. <FONT SIZE=-1><B>REDIRECTION</B>
  907. </FONT>
  908. below).
  909. The file descriptors can be utilized as arguments to shell commands
  910. and redirections using standard word expansions.
  911. The file descriptors are not available in subshells.
  912. The process ID of the shell spawned to execute the coprocess is
  913. available as the value of the variable <I>NAME</I>_PID.
  914. The <B>wait</B>
  915. builtin command may be used to wait for the coprocess to terminate.
  916. <P>
  917. Since the coprocess is created as an asynchronous command,
  918. the <B>coproc</B> command always returns success.
  919. The return status of a coprocess is the exit status of <I>command</I>.
  920. <A NAME="lbAQ">&nbsp;</A>
  921. <H4>Shell Function Definitions</H4>
  922. <P>
  923. A shell function is an object that is called like a simple command and
  924. executes a compound command with a new set of positional parameters.
  925. Shell functions are declared as follows:
  926. <DL COMPACT>
  927. <DT><I>name</I> () <I>compound-command</I> [<I>redirection</I>]<DD>
  928. <DT><B>function</B> <I>name</I> [()] <I>compound-command</I> [<I>redirection</I>]<DD>
  929. This defines a function named <I>name</I>.
  930. The reserved word <B>function</B> is optional.
  931. If the <B>function</B> reserved word is supplied, the parentheses are optional.
  932. The <I>body</I> of the function is the compound command
  933. <I>compound-command</I>
  934. (see <B>Compound Commands</B> above).
  935. That command is usually a <I>list</I> of commands between { and }, but
  936. may be any command listed under <B>Compound Commands</B> above,
  937. with one exception: If the <B>function</B> reserved word is used, but the
  938. parentheses are not supplied, the braces are required.
  939. <I>compound-command</I> is executed whenever <I>name</I> is specified as the
  940. name of a simple command.
  941. When in <I>posix mode</I>, <I>name</I> may not be the name of one of the
  942. POSIX <I>special builtins</I>.
  943. Any redirections (see
  944. <FONT SIZE=-1><B>REDIRECTION</B>
  945. </FONT>
  946. below) specified when a function is defined are performed
  947. when the function is executed.
  948. The exit status of a function definition is zero unless a syntax error
  949. occurs or a readonly function with the same name already exists.
  950. When executed, the exit status of a function is the exit status of the
  951. last command executed in the body. (See
  952. <FONT SIZE=-1><B>FUNCTIONS</B>
  953. </FONT>
  954. below.)
  955. </DL>
  956. <A NAME="lbAR">&nbsp;</A>
  957. <H3>COMMENTS</H3>
  958. In a non-interactive shell, or an interactive shell in which the
  959. <B>interactive_comments</B>
  960. option to the
  961. <B>shopt</B>
  962. builtin is enabled (see
  963. <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
  964. </FONT>
  965. below), a word beginning with
  966. <B>#</B>
  967. causes that word and all remaining characters on that line to
  968. be ignored. An interactive shell without the
  969. <B>interactive_comments</B>
  970. option enabled does not allow comments. The
  971. <B>interactive_comments</B>
  972. option is on by default in interactive shells.
  973. <A NAME="lbAS">&nbsp;</A>
  974. <H3>QUOTING</H3>
  975. <I>Quoting</I> is used to remove the special meaning of certain
  976. characters or words to the shell. Quoting can be used to
  977. disable special treatment for special characters, to prevent
  978. reserved words from being recognized as such, and to prevent
  979. parameter expansion.
  980. <P>
  981. Each of the <I>metacharacters</I> listed above under
  982. <FONT SIZE=-1><B>DEFINITIONS</B>
  983. </FONT>
  984. has special meaning to the shell and must be quoted if it is to
  985. represent itself.
  986. <P>
  987. When the command history expansion facilities are being used
  988. (see
  989. <FONT SIZE=-1><B>HISTORY EXPANSION</B>
  990. </FONT>
  991. below), the
  992. <I>history expansion</I> character, usually <B>!</B>, must be quoted
  993. to prevent history expansion.
  994. <P>
  995. There are three quoting mechanisms: the
  996. <I>escape character</I>,
  997. single quotes, and double quotes.
  998. <P>
  999. A non-quoted backslash (<B>\</B>) is the
  1000. <I>escape character</I>.
  1001. It preserves the literal value of the next character that follows,
  1002. with the exception of &lt;newline&gt;. If a <B>\</B>&lt;newline&gt; pair
  1003. appears, and the backslash is not itself quoted, the <B>\</B>&lt;newline&gt;
  1004. is treated as a line continuation (that is, it is removed from the
  1005. input stream and effectively ignored).
  1006. <P>
  1007. Enclosing characters in single quotes preserves the literal value
  1008. of each character within the quotes. A single quote may not occur
  1009. between single quotes, even when preceded by a backslash.
  1010. <P>
  1011. Enclosing characters in double quotes preserves the literal value
  1012. of all characters within the quotes, with the exception of
  1013. <B>$</B>,
  1014. <B>`</B>,
  1015. <B>\</B>,
  1016. and, when history expansion is enabled,
  1017. <B>!</B>.
  1018. When the shell is in <I>posix mode</I>, the <B>!</B> has no special meaning
  1019. within double quotes, even when history expansion is enabled.
  1020. The characters
  1021. <B>$</B>
  1022. and
  1023. <B>`</B>
  1024. retain their special meaning within double quotes. The backslash
  1025. retains its special meaning only when followed by one of the following
  1026. characters:
  1027. <B>$</B>,
  1028. <B>`</B>,
  1029. <B>&quot;</B>,
  1030. <B>\</B>,
  1031. or
  1032. <B>&lt;newline&gt;</B>.
  1033. A double quote may be quoted within double quotes by preceding it with
  1034. a backslash.
  1035. If enabled, history expansion will be performed unless an
  1036. <B>!</B>
  1037. appearing in double quotes is escaped using a backslash.
  1038. The backslash preceding the
  1039. <B>!</B>
  1040. is not removed.
  1041. <P>
  1042. The special parameters
  1043. <B>*</B>
  1044. and
  1045. <B>@</B>
  1046. have special meaning when in double
  1047. quotes (see
  1048. <FONT SIZE=-1><B>PARAMETERS</B>
  1049. </FONT>
  1050. below).
  1051. <P>
  1052. Words of the form <B>$</B>aq<I>string</I>aq are treated specially. The
  1053. word expands to <I>string</I>, with backslash-escaped characters replaced
  1054. as specified by the ANSI C standard. Backslash escape sequences, if
  1055. present, are decoded as follows:
  1056. <DL COMPACT><DT><DD>
  1057. <DL COMPACT>
  1058. <DT><B>\a</B>
  1059. <DD>
  1060. alert (bell)
  1061. <DT><B>\b</B>
  1062. <DD>
  1063. backspace
  1064. <DT><B>\e</B>
  1065. <DD>
  1066. <DT><B>\E</B>
  1067. <DD>
  1068. an escape character
  1069. <DT><B>\f</B>
  1070. <DD>
  1071. form feed
  1072. <DT><B>\n</B>
  1073. <DD>
  1074. new line
  1075. <DT><B>\r</B>
  1076. <DD>
  1077. carriage return
  1078. <DT><B>\t</B>
  1079. <DD>
  1080. horizontal tab
  1081. <DT><B>\v</B>
  1082. <DD>
  1083. vertical tab
  1084. <DT><B>\\</B>
  1085. <DD>
  1086. backslash
  1087. <DT><B>\aq</B>
  1088. <DD>
  1089. single quote
  1090. <DT><B>\dq</B>
  1091. <DD>
  1092. double quote
  1093. <DT><B>\?</B>
  1094. <DD>
  1095. question mark
  1096. <DT><B>\</B><I>nnn</I>
  1097. <DD>
  1098. the eight-bit character whose value is the octal value <I>nnn</I>
  1099. (one to three digits)
  1100. <DT><B>\x</B><I>HH</I>
  1101. <DD>
  1102. the eight-bit character whose value is the hexadecimal value <I>HH</I>
  1103. (one or two hex digits)
  1104. <DT><B>\u</B><I>HHHH</I>
  1105. <DD>
  1106. the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value
  1107. <I>HHHH</I> (one to four hex digits)
  1108. <DT><B>\U</B><I>HHHHHHHH</I>
  1109. <DD>
  1110. the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value
  1111. <I>HHHHHHHH</I> (one to eight hex digits)
  1112. <DT><B>\c</B><I>x</I>
  1113. <DD>
  1114. a control-<I>x</I> character
  1115. </DL></DL>
  1116. <P>
  1117. The expanded result is single-quoted, as if the dollar sign had
  1118. not been present.
  1119. <P>
  1120. A double-quoted string preceded by a dollar sign (<B>$</B>dq<I>string</I>dq)
  1121. will cause the string to be translated according to the current locale.
  1122. If the current locale is <B>C</B> or <B>POSIX</B>, the dollar sign
  1123. is ignored.
  1124. If the string is translated and replaced, the replacement is
  1125. double-quoted.
  1126. <A NAME="lbAT">&nbsp;</A>
  1127. <H3>PARAMETERS</H3>
  1128. A
  1129. <I>parameter</I>
  1130. is an entity that stores values.
  1131. It can be a
  1132. <I>name</I>,
  1133. a number, or one of the special characters listed below under
  1134. <B>Special Parameters</B>.
  1135. A
  1136. <I>variable</I>
  1137. is a parameter denoted by a
  1138. <I>name</I>.
  1139. A variable has a <I>value</I> and zero or more <I>attributes</I>.
  1140. Attributes are assigned using the
  1141. <B>declare</B>
  1142. builtin command (see
  1143. <B>declare</B>
  1144. below in
  1145. <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>).
  1146. </FONT>
  1147. <P>
  1148. A parameter is set if it has been assigned a value. The null string is
  1149. a valid value. Once a variable is set, it may be unset only by using
  1150. the
  1151. <B>unset</B>
  1152. builtin command (see
  1153. <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
  1154. </FONT>
  1155. below).
  1156. <P>
  1157. A
  1158. <I>variable</I>
  1159. may be assigned to by a statement of the form
  1160. <DL COMPACT><DT><DD>
  1161. <P>
  1162. <I>name</I>=[<I>value</I>]
  1163. </DL>
  1164. <P>
  1165. If
  1166. <I>value</I>
  1167. is not given, the variable is assigned the null string. All
  1168. <I>values</I>
  1169. undergo tilde expansion, parameter and variable expansion,
  1170. command substitution, arithmetic expansion, and quote
  1171. removal (see
  1172. <FONT SIZE=-1><B>EXPANSION</B>
  1173. </FONT>
  1174. below). If the variable has its
  1175. <B>integer</B>
  1176. attribute set, then
  1177. <I>value</I>
  1178. is evaluated as an arithmetic expression even if the $((...)) expansion is
  1179. not used (see
  1180. <B>Arithmetic Expansion</B>
  1181. below).
  1182. Word splitting is not performed, with the exception
  1183. of <B>&quot;$@&quot;</B> as explained below under
  1184. <B>Special Parameters</B>.
  1185. Pathname expansion is not performed.
  1186. Assignment statements may also appear as arguments to the
  1187. <B>alias</B>,
  1188. <B>declare</B>,
  1189. <B>typeset</B>,
  1190. <B>export</B>,
  1191. <B>readonly</B>,
  1192. and
  1193. <B>local</B>
  1194. builtin commands (<I>declaration</I> commands).
  1195. When in <I>posix mode</I>, these builtins may appear in a command after
  1196. one or more instances of the <B>command</B> builtin and retain these
  1197. assignment statement properties.
  1198. <P>
  1199. In the context where an assignment statement is assigning a value
  1200. to a shell variable or array index, the += operator can be used to
  1201. append to or add to the variable's previous value.
  1202. This includes arguments to builtin commands such as <B>declare</B> that
  1203. accept assignment statements (<I>declaration</I> commands).
  1204. When += is applied to a variable for which the <I>integer</I> attribute has been
  1205. set, <I>value</I> is evaluated as an arithmetic expression and added to the
  1206. variable's current value, which is also evaluated.
  1207. When += is applied to an array variable using compound assignment (see
  1208. <B>Arrays</B>
  1209. below), the
  1210. variable's value is not unset (as it is when using =), and new values are
  1211. appended to the array beginning at one greater than the array's maximum index
  1212. (for indexed arrays) or added as additional key-value pairs in an
  1213. associative array.
  1214. When applied to a string-valued variable, <I>value</I> is expanded and
  1215. appended to the variable's value.
  1216. <P>
  1217. A variable can be assigned the <I>nameref</I> attribute using the
  1218. <B>-n</B> option to the <B>declare</B> or <B>local</B> builtin commands
  1219. (see the descriptions of <B>declare</B> and <B>local</B> below)
  1220. to create a <I>nameref</I>, or a reference to another variable.
  1221. This allows variables to be manipulated indirectly.
  1222. Whenever the nameref variable is referenced, assigned to, unset, or has
  1223. its attributes modified (other than using or changing the <I>nameref</I>
  1224. attribute itself), the
  1225. operation is actually performed on the variable specified by the nameref
  1226. variable's value.
  1227. A nameref is commonly used within shell functions to refer to a variable
  1228. whose name is passed as an argument to the function.
  1229. For instance, if a variable name is passed to a shell function as its first
  1230. argument, running
  1231. <P>
  1232. <DL COMPACT><DT><DD>
  1233. <TT>declare -n ref=$1</TT>
  1234. </DL>
  1235. <P>
  1236. inside the function creates a nameref variable <B>ref</B> whose value is
  1237. the variable name passed as the first argument.
  1238. References and assignments to <B>ref</B>, and changes to its attributes,
  1239. are treated as references, assignments, and attribute modifications
  1240. to the variable whose name was passed as <B>$1</B>.
  1241. If the control variable in a <B>for</B> loop has the nameref attribute,
  1242. the list of words can be a list of shell variables, and a name reference
  1243. will be established for each word in the list, in turn, when the loop is
  1244. executed.
  1245. Array variables cannot be given the <B>nameref</B> attribute.
  1246. However, nameref variables can reference array variables and subscripted
  1247. array variables.
  1248. Namerefs can be unset using the <B>-n</B> option to the <B>unset</B> builtin.
  1249. Otherwise, if <B>unset</B> is executed with the name of a nameref variable
  1250. as an argument, the variable referenced by the nameref variable will be unset.
  1251. <A NAME="lbAU">&nbsp;</A>
  1252. <H4>Positional Parameters</H4>
  1253. <P>
  1254. A
  1255. <I>positional parameter</I>
  1256. is a parameter denoted by one or more
  1257. digits, other than the single digit 0. Positional parameters are
  1258. assigned from the shell's arguments when it is invoked,
  1259. and may be reassigned using the
  1260. <B>set</B>
  1261. builtin command. Positional parameters may not be assigned to
  1262. with assignment statements. The positional parameters are
  1263. temporarily replaced when a shell function is executed (see
  1264. <FONT SIZE=-1><B>FUNCTIONS</B>
  1265. </FONT>
  1266. below).
  1267. <P>
  1268. When a positional parameter consisting of more than a single
  1269. digit is expanded, it must be enclosed in braces (see
  1270. <FONT SIZE=-1><B>EXPANSION</B>
  1271. </FONT>
  1272. below).
  1273. <A NAME="lbAV">&nbsp;</A>
  1274. <H4>Special Parameters</H4>
  1275. <P>
  1276. The shell treats several parameters specially. These parameters may
  1277. only be referenced; assignment to them is not allowed.
  1278. <DL COMPACT>
  1279. <DT><B>*</B>
  1280. <DD>
  1281. Expands to the positional parameters, starting from one.
  1282. When the expansion is not within double quotes, each positional parameter
  1283. expands to a separate word.
  1284. In contexts where it is performed, those words
  1285. are subject to further word splitting and pathname expansion.
  1286. When the expansion occurs within double quotes, it expands to a single word
  1287. with the value of each parameter separated by the first character of the
  1288. <FONT SIZE=-1><B>IFS</B>
  1289. </FONT>
  1290. special variable. That is, &quot;<B>$*</B>&quot; is equivalent
  1291. to &quot;<B>$1</B><I>c</I><B>$2</B><I>c</I><B>...</B>&quot;, where
  1292. <I>c</I>
  1293. is the first character of the value of the
  1294. <FONT SIZE=-1><B>IFS</B>
  1295. </FONT>
  1296. variable. If
  1297. <FONT SIZE=-1><B>IFS</B>
  1298. </FONT>
  1299. is unset, the parameters are separated by spaces.
  1300. If
  1301. <FONT SIZE=-1><B>IFS</B>
  1302. </FONT>
  1303. is null, the parameters are joined without intervening separators.
  1304. <DT><B>@</B>
  1305. <DD>
  1306. Expands to the positional parameters, starting from one. When the
  1307. expansion occurs within double quotes, each parameter expands to a
  1308. separate word. That is, &quot;<B>$@</B>&quot; is equivalent to
  1309. &quot;<B>$1</B>&quot; &quot;<B>$2</B>&quot; ...
  1310. If the double-quoted expansion occurs within a word, the expansion of
  1311. the first parameter is joined with the beginning part of the original
  1312. word, and the expansion of the last parameter is joined with the last
  1313. part of the original word.
  1314. When there are no positional parameters, &quot;<B>$@</B>&quot; and
  1315. <B>$@</B>
  1316. expand to nothing (i.e., they are removed).
  1317. <DT><B>#</B>
  1318. <DD>
  1319. Expands to the number of positional parameters in decimal.
  1320. <DT><B>?</B>
  1321. <DD>
  1322. Expands to the exit status of the most recently executed foreground
  1323. pipeline.
  1324. <DT><B>-</B>
  1325. <DD>
  1326. Expands to the current option flags as specified upon invocation,
  1327. by the
  1328. <B>set</B>
  1329. builtin command, or those set by the shell itself
  1330. (such as the
  1331. <B>-i</B>
  1332. option).
  1333. <DT><B>$</B>
  1334. <DD>
  1335. Expands to the process ID of the shell. In a () subshell, it
  1336. expands to the process ID of the current shell, not the
  1337. subshell.
  1338. <DT><B>!</B>
  1339. <DD>
  1340. Expands to the process ID of the job most recently placed into the
  1341. background, whether executed as an asynchronous command or using
  1342. the <B>bg</B> builtin (see
  1343. <FONT SIZE=-1><B>JOB CONTROL</B>
  1344. </FONT>
  1345. below).
  1346. <DT><B>0</B>
  1347. <DD>
  1348. Expands to the name of the shell or shell script. This is set at
  1349. shell initialization. If
  1350. <B>bash</B>
  1351. is invoked with a file of commands,
  1352. <B>$0</B>
  1353. is set to the name of that file. If
  1354. <B>bash</B>
  1355. is started with the
  1356. <B>-c</B>
  1357. option, then
  1358. <B>$0</B>
  1359. is set to the first argument after the string to be
  1360. executed, if one is present. Otherwise, it is set
  1361. to the filename used to invoke
  1362. <B>bash</B>,
  1363. as given by argument zero.
  1364. <DT><B>_</B>
  1365. <DD>
  1366. At shell startup, set to the absolute pathname used to invoke the
  1367. shell or shell script being executed as passed in the environment
  1368. or argument list.
  1369. Subsequently, expands to the last argument to the previous command,
  1370. after expansion.
  1371. Also set to the full pathname used to invoke each command executed
  1372. and placed in the environment exported to that command.
  1373. When checking mail, this parameter holds the name of the mail file
  1374. currently being checked.
  1375. </DL>
  1376. <A NAME="lbAW">&nbsp;</A>
  1377. <H4>Shell Variables</H4>
  1378. <P>
  1379. The following variables are set by the shell:
  1380. <P>
  1381. <DL COMPACT>
  1382. <DT><B>BASH</B>
  1383. <DD>
  1384. Expands to the full filename used to invoke this instance of
  1385. <B>bash</B>.
  1386. <DT><B>BASHOPTS</B>
  1387. <DD>
  1388. A colon-separated list of enabled shell options. Each word in
  1389. the list is a valid argument for the
  1390. <B>-s</B>
  1391. option to the
  1392. <B>shopt</B>
  1393. builtin command (see
  1394. <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
  1395. </FONT>
  1396. below). The options appearing in
  1397. <FONT SIZE=-1><B>BASHOPTS</B>
  1398. </FONT>
  1399. are those reported as
  1400. <I>on</I>
  1401. by <B>shopt</B>.
  1402. If this variable is in the environment when
  1403. <B>bash</B>
  1404. starts up, each shell option in the list will be enabled before
  1405. reading any startup files.
  1406. This variable is read-only.
  1407. <DT><B>BASHPID</B>
  1408. <DD>
  1409. Expands to the process ID of the current <B>bash</B> process.
  1410. This differs from <B>$$</B> under certain circumstances, such as subshells
  1411. that do not require <B>bash</B> to be re-initialized.
  1412. <DT><B>BASH_ALIASES</B>
  1413. <DD>
  1414. An associative array variable whose members correspond to the internal
  1415. list of aliases as maintained by the <B>alias</B> builtin.
  1416. Elements added to this array appear in the alias list; however,
  1417. unsetting array elements currently does not cause aliases to be removed
  1418. from the alias list.
  1419. If
  1420. <B>BASH_ALIASES</B>
  1421. is unset, it loses its special properties, even if it is
  1422. subsequently reset.
  1423. <DT><B>BASH_ARGC</B>
  1424. <DD>
  1425. An array variable whose values are the number of parameters in each
  1426. frame of the current <B>bash</B> execution call stack.
  1427. The number of
  1428. parameters to the current subroutine (shell function or script executed
  1429. with <B>.</B> or <B>source</B>) is at the top of the stack.
  1430. When a subroutine is executed, the number of parameters passed is pushed onto
  1431. <FONT SIZE=-1><B>BASH_ARGC</B>.
  1432. </FONT>
  1433. The shell sets
  1434. <FONT SIZE=-1><B>BASH_ARGC</B>
  1435. </FONT>
  1436. only when in extended debugging mode (see the description of the
  1437. <B>extdebug</B>
  1438. option to the
  1439. <B>shopt</B>
  1440. builtin below)
  1441. <DT><B>BASH_ARGV</B>
  1442. <DD>
  1443. An array variable containing all of the parameters in the current <B>bash</B>
  1444. execution call stack. The final parameter of the last subroutine call
  1445. is at the top of the stack; the first parameter of the initial call is
  1446. at the bottom. When a subroutine is executed, the parameters supplied
  1447. are pushed onto
  1448. <FONT SIZE=-1><B>BASH_ARGV</B>.
  1449. </FONT>
  1450. The shell sets
  1451. <FONT SIZE=-1><B>BASH_ARGV</B>
  1452. </FONT>
  1453. only when in extended debugging mode
  1454. (see the description of the
  1455. <B>extdebug</B>
  1456. option to the
  1457. <B>shopt</B>
  1458. builtin below)
  1459. <DT><B>BASH_CMDS</B>
  1460. <DD>
  1461. An associative array variable whose members correspond to the internal
  1462. hash table of commands as maintained by the <B>hash</B> builtin.
  1463. Elements added to this array appear in the hash table; however,
  1464. unsetting array elements currently does not cause command names to be removed
  1465. from the hash table.
  1466. If
  1467. <B>BASH_CMDS</B>
  1468. is unset, it loses its special properties, even if it is
  1469. subsequently reset.
  1470. <DT><B>BASH_COMMAND</B>
  1471. <DD>
  1472. The command currently being executed or about to be executed, unless the
  1473. shell is executing a command as the result of a trap,
  1474. in which case it is the command executing at the time of the trap.
  1475. <DT><B>BASH_EXECUTION_STRING</B>
  1476. <DD>
  1477. The command argument to the <B>-c</B> invocation option.
  1478. <DT><B>BASH_LINENO</B>
  1479. <DD>
  1480. An array variable whose members are the line numbers in source files
  1481. where each corresponding member of
  1482. <FONT SIZE=-1><B>FUNCNAME</B>
  1483. </FONT>
  1484. was invoked.
  1485. <B>${BASH_LINENO[</B><I>$i</I><B>]}</B> is the line number in the source
  1486. file (<B>${BASH_SOURCE[</B><I>$i+1</I><B>]}</B>) where
  1487. <B>${FUNCNAME[</B><I>$i</I><B>]}</B> was called
  1488. (or <B>${BASH_LINENO[</B><I>$i-1</I><B>]}</B> if referenced within another
  1489. shell function).
  1490. Use
  1491. <FONT SIZE=-1><B>LINENO</B>
  1492. </FONT>
  1493. to obtain the current line number.
  1494. <DT><B>BASH_LOADABLES_PATH</B>
  1495. <DD>
  1496. A colon-separated list of directories in which the shell looks for
  1497. dynamically loadable builtins specified by the
  1498. <B>enable</B>
  1499. command.
  1500. <DT><B>BASH_REMATCH</B>
  1501. <DD>
  1502. An array variable whose members are assigned by the <B>=~</B> binary
  1503. operator to the <B>[[</B> conditional command.
  1504. The element with index 0 is the portion of the string
  1505. matching the entire regular expression.
  1506. The element with index <I>n</I> is the portion of the
  1507. string matching the <I>n</I>th parenthesized subexpression.
  1508. This variable is read-only.
  1509. <DT><B>BASH_SOURCE</B>
  1510. <DD>
  1511. An array variable whose members are the source filenames
  1512. where the corresponding shell function names in the
  1513. <FONT SIZE=-1><B>FUNCNAME</B>
  1514. </FONT>
  1515. array variable are defined.
  1516. The shell function
  1517. <B>${FUNCNAME[</B><I>$i</I><B>]}</B> is defined in the file
  1518. <B>${BASH_SOURCE[</B><I>$i</I><B>]}</B> and called from
  1519. <B>${BASH_SOURCE[</B><I>$i+1</I><B>]}</B>.
  1520. <DT><B>BASH_SUBSHELL</B>
  1521. <DD>
  1522. Incremented by one within each subshell or subshell environment when
  1523. the shell begins executing in that environment.
  1524. The initial value is 0.
  1525. <DT><B>BASH_VERSINFO</B>
  1526. <DD>
  1527. A readonly array variable whose members hold version information for
  1528. this instance of
  1529. <B>bash</B>.
  1530. The values assigned to the array members are as follows:
  1531. <P>
  1532. <DL COMPACT><DT><DD>
  1533. <DL COMPACT>
  1534. <DT><B>BASH_VERSINFO[</B>0]
  1535. <DD>
  1536. The major version number (the <I>release</I>).
  1537. <DT><B>BASH_VERSINFO[</B>1]
  1538. <DD>
  1539. The minor version number (the <I>version</I>).
  1540. <DT><B>BASH_VERSINFO[</B>2]
  1541. <DD>
  1542. The patch level.
  1543. <DT><B>BASH_VERSINFO[</B>3]
  1544. <DD>
  1545. The build version.
  1546. <DT><B>BASH_VERSINFO[</B>4]
  1547. <DD>
  1548. The release status (e.g., <I>beta1</I>).
  1549. <DT><B>BASH_VERSINFO[</B>5]
  1550. <DD>
  1551. The value of
  1552. <FONT SIZE=-1><B>MACHTYPE</B>.
  1553. </FONT>
  1554. </DL></DL>
  1555. <DT><B>BASH_VERSION</B>
  1556. <DD>
  1557. Expands to a string describing the version of this instance of
  1558. <B>bash</B>.
  1559. <DT><B>COMP_CWORD</B>
  1560. <DD>
  1561. An index into <B>${COMP_WORDS}</B> of the word containing the current
  1562. cursor position.
  1563. This variable is available only in shell functions invoked by the
  1564. programmable completion facilities (see <B>Programmable Completion</B>
  1565. below).
  1566. <DT><B>COMP_KEY</B>
  1567. <DD>
  1568. The key (or final key of a key sequence) used to invoke the current
  1569. completion function.
  1570. <DT><B>COMP_LINE</B>
  1571. <DD>
  1572. The current command line.
  1573. This variable is available only in shell functions and external
  1574. commands invoked by the
  1575. programmable completion facilities (see <B>Programmable Completion</B>
  1576. below).
  1577. <DT><B>COMP_POINT</B>
  1578. <DD>
  1579. The index of the current cursor position relative to the beginning of
  1580. the current command.
  1581. If the current cursor position is at the end of the current command,
  1582. the value of this variable is equal to <B>${#COMP_LINE}</B>.
  1583. This variable is available only in shell functions and external
  1584. commands invoked by the
  1585. programmable completion facilities (see <B>Programmable Completion</B>
  1586. below).
  1587. <DT><B>COMP_TYPE</B>
  1588. <DD>
  1589. Set to an integer value corresponding to the type of completion attempted
  1590. that caused a completion function to be called:
  1591. <I>TAB</I>, for normal completion,
  1592. <I>?</I>, for listing completions after successive tabs,
  1593. <I>!</I>, for listing alternatives on partial word completion,
  1594. <I>@</I>, to list completions if the word is not unmodified,
  1595. or
  1596. <I>%</I>, for menu completion.
  1597. This variable is available only in shell functions and external
  1598. commands invoked by the
  1599. programmable completion facilities (see <B>Programmable Completion</B>
  1600. below).
  1601. <DT><B>COMP_WORDBREAKS</B>
  1602. <DD>
  1603. The set of characters that the <B>readline</B> library treats as word
  1604. separators when performing word completion.
  1605. If
  1606. <FONT SIZE=-1><B>COMP_WORDBREAKS</B>
  1607. </FONT>
  1608. is unset, it loses its special properties, even if it is
  1609. subsequently reset.
  1610. <DT><B>COMP_WORDS</B>
  1611. <DD>
  1612. An array variable (see <B>Arrays</B> below) consisting of the individual
  1613. words in the current command line.
  1614. The line is split into words as <B>readline</B> would split it, using
  1615. <FONT SIZE=-1><B>COMP_WORDBREAKS</B>
  1616. </FONT>
  1617. as described above.
  1618. This variable is available only in shell functions invoked by the
  1619. programmable completion facilities (see <B>Programmable Completion</B>
  1620. below).
  1621. <DT><B>COPROC</B>
  1622. <DD>
  1623. An array variable (see <B>Arrays</B> below) created to hold the file descriptors
  1624. for output from and input to an unnamed coprocess (see <B>Coprocesses</B>
  1625. above).
  1626. <DT><B>DIRSTACK</B>
  1627. <DD>
  1628. An array variable (see
  1629. <B>Arrays</B>
  1630. below) containing the current contents of the directory stack.
  1631. Directories appear in the stack in the order they are displayed by the
  1632. <B>dirs</B>
  1633. builtin.
  1634. Assigning to members of this array variable may be used to modify
  1635. directories already in the stack, but the
  1636. <B>pushd</B>
  1637. and
  1638. <B>popd</B>
  1639. builtins must be used to add and remove directories.
  1640. Assignment to this variable will not change the current directory.
  1641. If
  1642. <FONT SIZE=-1><B>DIRSTACK</B>
  1643. </FONT>
  1644. is unset, it loses its special properties, even if it is
  1645. subsequently reset.
  1646. <DT><B>EUID</B>
  1647. <DD>
  1648. Expands to the effective user ID of the current user, initialized at
  1649. shell startup. This variable is readonly.
  1650. <DT><B>FUNCNAME</B>
  1651. <DD>
  1652. An array variable containing the names of all shell functions
  1653. currently in the execution call stack.
  1654. The element with index 0 is the name of any currently-executing
  1655. shell function.
  1656. The bottom-most element (the one with the highest index) is
  1657. <TT>&quot;main&quot;</TT>.
  1658. This variable exists only when a shell function is executing.
  1659. Assignments to
  1660. <FONT SIZE=-1><B>FUNCNAME</B>
  1661. </FONT>
  1662. have no effect.
  1663. If
  1664. <FONT SIZE=-1><B>FUNCNAME</B>
  1665. </FONT>
  1666. is unset, it loses its special properties, even if it is
  1667. subsequently reset.
  1668. <P>
  1669. This variable can be used with <B>BASH_LINENO</B> and <B>BASH_SOURCE</B>.
  1670. Each element of <B>FUNCNAME</B> has corresponding elements in
  1671. <B>BASH_LINENO</B> and <B>BASH_SOURCE</B> to describe the call stack.
  1672. For instance, <B>${FUNCNAME[</B><I>$i</I><B>]}</B> was called from the file
  1673. <B>${BASH_SOURCE[</B><I>$i+1</I><B>]}</B> at line number
  1674. <B>${BASH_LINENO[</B><I>$i</I><B>]}</B>.
  1675. The <B>caller</B> builtin displays the current call stack using this
  1676. information.
  1677. <DT><B>GROUPS</B>
  1678. <DD>
  1679. An array variable containing the list of groups of which the current
  1680. user is a member.
  1681. Assignments to
  1682. <FONT SIZE=-1><B>GROUPS</B>
  1683. </FONT>
  1684. have no effect.
  1685. If
  1686. <FONT SIZE=-1><B>GROUPS</B>
  1687. </FONT>
  1688. is unset, it loses its special properties, even if it is
  1689. subsequently reset.
  1690. <DT><B>HISTCMD</B>
  1691. <DD>
  1692. The history number, or index in the history list, of the current
  1693. command.
  1694. If
  1695. <FONT SIZE=-1><B>HISTCMD</B>
  1696. </FONT>
  1697. is unset, it loses its special properties, even if it is
  1698. subsequently reset.
  1699. <DT><B>HOSTNAME</B>
  1700. <DD>
  1701. Automatically set to the name of the current host.
  1702. <DT><B>HOSTTYPE</B>
  1703. <DD>
  1704. Automatically set to a string that uniquely
  1705. describes the type of machine on which
  1706. <B>bash</B>
  1707. is executing.
  1708. The default is system-dependent.
  1709. <DT><B>LINENO</B>
  1710. <DD>
  1711. Each time this parameter is referenced, the shell substitutes
  1712. a decimal number representing the current sequential line number
  1713. (starting with 1) within a script or function. When not in a
  1714. script or function, the value substituted is not guaranteed to
  1715. be meaningful.
  1716. If
  1717. <FONT SIZE=-1><B>LINENO</B>
  1718. </FONT>
  1719. is unset, it loses its special properties, even if it is
  1720. subsequently reset.
  1721. <DT><B>MACHTYPE</B>
  1722. <DD>
  1723. Automatically set to a string that fully describes the system
  1724. type on which
  1725. <B>bash</B>
  1726. is executing, in the standard GNU <I>cpu-company-system</I> format.
  1727. The default is system-dependent.
  1728. <DT><B>MAPFILE</B>
  1729. <DD>
  1730. An array variable (see <B>Arrays</B> below) created to hold the text
  1731. read by the <B>mapfile</B> builtin when no variable name is supplied.
  1732. <DT><B>OLDPWD</B>
  1733. <DD>
  1734. The previous working directory as set by the
  1735. <B>cd</B>
  1736. command.
  1737. <DT><B>OPTARG</B>
  1738. <DD>
  1739. The value of the last option argument processed by the
  1740. <B>getopts</B>
  1741. builtin command (see
  1742. <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
  1743. </FONT>
  1744. below).
  1745. <DT><B>OPTIND</B>
  1746. <DD>
  1747. The index of the next argument to be processed by the
  1748. <B>getopts</B>
  1749. builtin command (see
  1750. <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
  1751. </FONT>
  1752. below).
  1753. <DT><B>OSTYPE</B>
  1754. <DD>
  1755. Automatically set to a string that
  1756. describes the operating system on which
  1757. <B>bash</B>
  1758. is executing.
  1759. The default is system-dependent.
  1760. <DT><B>PIPESTATUS</B>
  1761. <DD>
  1762. An array variable (see
  1763. <B>Arrays</B>
  1764. below) containing a list of exit status values from the processes
  1765. in the most-recently-executed foreground pipeline (which may
  1766. contain only a single command).
  1767. <DT><B>PPID</B>
  1768. <DD>
  1769. The process ID of the shell's parent. This variable is readonly.
  1770. <DT><B>PWD</B>
  1771. <DD>
  1772. The current working directory as set by the
  1773. <B>cd</B>
  1774. command.
  1775. <DT><B>RANDOM</B>
  1776. <DD>
  1777. Each time this parameter is referenced, a random integer between
  1778. 0 and 32767 is
  1779. generated. The sequence of random numbers may be initialized by assigning
  1780. a value to
  1781. <FONT SIZE=-1><B>RANDOM</B>.
  1782. </FONT>
  1783. If
  1784. <FONT SIZE=-1><B>RANDOM</B>
  1785. </FONT>
  1786. is unset, it loses its special properties, even if it is
  1787. subsequently reset.
  1788. <DT><B>READLINE_LINE</B>
  1789. <DD>
  1790. The contents of the
  1791. <B>readline</B>
  1792. line buffer, for use with
  1793. <TT>bind -x</TT>
  1794. (see
  1795. <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
  1796. </FONT>
  1797. below).
  1798. <DT><B>READLINE_POINT</B>
  1799. <DD>
  1800. The position of the insertion point in the
  1801. <B>readline</B>
  1802. line buffer, for use with
  1803. <TT>bind -x</TT>
  1804. (see
  1805. <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
  1806. </FONT>
  1807. below).
  1808. <DT><B>REPLY</B>
  1809. <DD>
  1810. Set to the line of input read by the
  1811. <B>read</B>
  1812. builtin command when no arguments are supplied.
  1813. <DT><B>SECONDS</B>
  1814. <DD>
  1815. Each time this parameter is
  1816. referenced, the number of seconds since shell invocation is returned. If a
  1817. value is assigned to
  1818. <FONT SIZE=-1><B>SECONDS</B>,
  1819. </FONT>
  1820. the value returned upon subsequent
  1821. references is
  1822. the number of seconds since the assignment plus the value assigned.
  1823. If
  1824. <FONT SIZE=-1><B>SECONDS</B>
  1825. </FONT>
  1826. is unset, it loses its special properties, even if it is
  1827. subsequently reset.
  1828. <DT><B>SHELLOPTS</B>
  1829. <DD>
  1830. A colon-separated list of enabled shell options. Each word in
  1831. the list is a valid argument for the
  1832. <B>-o</B>
  1833. option to the
  1834. <B>set</B>
  1835. builtin command (see
  1836. <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
  1837. </FONT>
  1838. below). The options appearing in
  1839. <FONT SIZE=-1><B>SHELLOPTS</B>
  1840. </FONT>
  1841. are those reported as
  1842. <I>on</I>
  1843. by <B>set -o</B>.
  1844. If this variable is in the environment when
  1845. <B>bash</B>
  1846. starts up, each shell option in the list will be enabled before
  1847. reading any startup files.
  1848. This variable is read-only.
  1849. <DT><B>SHLVL</B>
  1850. <DD>
  1851. Incremented by one each time an instance of
  1852. <B>bash</B>
  1853. is started.
  1854. <DT><B>UID</B>
  1855. <DD>
  1856. Expands to the user ID of the current user, initialized at shell startup.
  1857. This variable is readonly.
  1858. </DL>
  1859. <P>
  1860. The following variables are used by the shell. In some cases,
  1861. <B>bash</B>
  1862. assigns a default value to a variable; these cases are noted
  1863. below.
  1864. <P>
  1865. <DL COMPACT>
  1866. <DT><B>BASH_COMPAT</B>
  1867. <DD>
  1868. The value is used to set the shell's compatibility level.
  1869. See the description of the <B>shopt</B> builtin below under
  1870. <B>SHELL BUILTIN COMMANDS</B>
  1871. for a description of the various compatibility
  1872. levels and their effects.
  1873. The value may be a decimal number (e.g., 4.2) or an integer (e.g., 42)
  1874. corresponding to the desired compatibility level.
  1875. If <B>BASH_COMPAT</B> is unset or set to the empty string, the compatibility
  1876. level is set to the default for the current version.
  1877. If <B>BASH_COMPAT</B> is set to a value that is not one of the valid
  1878. compatibility levels, the shell prints an error message and sets the
  1879. compatibility level to the default for the current version.
  1880. The valid compatibility levels correspond to the compatibility options
  1881. accepted by the <B>shopt</B> builtin described below (for example,
  1882. <B>compat42</B> means that 4.2 and 42 are valid values).
  1883. The current version is also a valid value.
  1884. <DT><B>BASH_ENV</B>
  1885. <DD>
  1886. If this parameter is set when <B>bash</B> is executing a shell script,
  1887. its value is interpreted as a filename containing commands to
  1888. initialize the shell, as in
  1889. <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>.
  1890. The value of
  1891. <FONT SIZE=-1><B>BASH_ENV</B>
  1892. </FONT>
  1893. is subjected to parameter expansion, command substitution, and arithmetic
  1894. expansion before being interpreted as a filename.
  1895. <FONT SIZE=-1><B>PATH</B>
  1896. </FONT>
  1897. is not used to search for the resultant filename.
  1898. <DT><B>BASH_XTRACEFD</B>
  1899. <DD>
  1900. If set to an integer corresponding to a valid file descriptor, <B>bash</B>
  1901. will write the trace output generated when
  1902. <TT>set -x</TT>
  1903. is enabled to that file descriptor.
  1904. The file descriptor is closed when
  1905. <FONT SIZE=-1><B>BASH_XTRACEFD</B>
  1906. </FONT>
  1907. is unset or assigned a new value.
  1908. Unsetting
  1909. <FONT SIZE=-1><B>BASH_XTRACEFD</B>
  1910. </FONT>
  1911. or assigning it the empty string causes the
  1912. trace output to be sent to the standard error.
  1913. Note that setting
  1914. <FONT SIZE=-1><B>BASH_XTRACEFD</B>
  1915. </FONT>
  1916. to 2 (the standard error file
  1917. descriptor) and then unsetting it will result in the standard error
  1918. being closed.
  1919. <DT><B>CDPATH</B>
  1920. <DD>
  1921. The search path for the
  1922. <B>cd</B>
  1923. command.
  1924. This is a colon-separated list of directories in which the shell looks
  1925. for destination directories specified by the
  1926. <B>cd</B>
  1927. command.
  1928. A sample value is
  1929. <TT>&quot;.:~:/usr&quot;</TT>.
  1930. <DT><B>CHILD_MAX</B>
  1931. <DD>
  1932. Set the number of exited child status values for the shell to remember.
  1933. Bash will not allow this value to be decreased below a POSIX-mandated
  1934. minimum, and there is a maximum value (currently 8192) that this may
  1935. not exceed.
  1936. The minimum value is system-dependent.
  1937. <DT><B>COLUMNS</B>
  1938. <DD>
  1939. Used by the <B>select</B> compound command to determine the terminal width
  1940. when printing selection lists.
  1941. Automatically set if the
  1942. <B>checkwinsize</B>
  1943. option is enabled or in an interactive shell upon receipt of a
  1944. <FONT SIZE=-1><B>SIGWINCH</B>.
  1945. </FONT>
  1946. <DT><B>COMPREPLY</B>
  1947. <DD>
  1948. An array variable from which <B>bash</B> reads the possible completions
  1949. generated by a shell function invoked by the programmable completion
  1950. facility (see <B>Programmable Completion</B> below).
  1951. Each array element contains one possible completion.
  1952. <DT><B>EMACS</B>
  1953. <DD>
  1954. If <B>bash</B> finds this variable in the environment when the shell starts
  1955. with value
  1956. <TT>t</TT>,
  1957. it assumes that the shell is running in an Emacs shell buffer and disables
  1958. line editing.
  1959. <DT><B>ENV</B>
  1960. <DD>
  1961. Similar to
  1962. <FONT SIZE=-1><B>BASH_ENV</B>;
  1963. </FONT>
  1964. used when the shell is invoked in POSIX mode.
  1965. <DT><B>EXECIGNORE</B>
  1966. <DD>
  1967. A colon-separated list of shell patterns (see <B>Pattern Matching</B>)
  1968. defining the list of filenames to be ignored by command search using
  1969. <B>PATH</B>.
  1970. Files whose full pathnames match one of these patterns are not considered
  1971. executable files for the purposes of completion and command execution
  1972. via <B>PATH</B> lookup.
  1973. This does not affect the behavior of the <B>[</B>, <B>test</B>, and <B>[[</B>
  1974. commands.
  1975. Full pathnames in the command hash table are not subject to <B>EXECIGNORE</B>.
  1976. Use this variable to ignore shared library files that have the executable
  1977. bit set, but are not executable files.
  1978. The pattern matching honors the setting of the <B>extglob</B> shell
  1979. option.
  1980. <DT><B>FCEDIT</B>
  1981. <DD>
  1982. The default editor for the
  1983. <B>fc</B>
  1984. builtin command.
  1985. <DT><B>FIGNORE</B>
  1986. <DD>
  1987. A colon-separated list of suffixes to ignore when performing
  1988. filename completion (see
  1989. <FONT SIZE=-1><B>READLINE</B>
  1990. </FONT>
  1991. below).
  1992. A filename whose suffix matches one of the entries in
  1993. <FONT SIZE=-1><B>FIGNORE</B>
  1994. </FONT>
  1995. is excluded from the list of matched filenames.
  1996. A sample value is
  1997. <TT>&quot;.o:~&quot;</TT>.
  1998. <DT><B>FUNCNEST</B>
  1999. <DD>
  2000. If set to a numeric value greater than 0, defines a maximum function
  2001. nesting level. Function invocations that exceed this nesting level
  2002. will cause the current command to abort.
  2003. <DT><B>GLOBIGNORE</B>
  2004. <DD>
  2005. A colon-separated list of patterns defining the set of filenames to
  2006. be ignored by pathname expansion.
  2007. If a filename matched by a pathname expansion pattern also matches one
  2008. of the patterns in
  2009. <FONT SIZE=-1><B>GLOBIGNORE</B>,
  2010. </FONT>
  2011. it is removed from the list of matches.
  2012. <DT><B>HISTCONTROL</B>
  2013. <DD>
  2014. A colon-separated list of values controlling how commands are saved on
  2015. the history list.
  2016. If the list of values includes
  2017. <I>ignorespace</I>,
  2018. lines which begin with a
  2019. <B>space</B>
  2020. character are not saved in the history list.
  2021. A value of
  2022. <I>ignoredups</I>
  2023. causes lines matching the previous history entry to not be saved.
  2024. A value of
  2025. <I>ignoreboth</I>
  2026. is shorthand for <I>ignorespace</I> and <I>ignoredups</I>.
  2027. A value of
  2028. <I>erasedups</I>
  2029. causes all previous lines matching the current line to be removed from
  2030. the history list before that line is saved.
  2031. Any value not in the above list is ignored.
  2032. If
  2033. <FONT SIZE=-1><B>HISTCONTROL</B>
  2034. </FONT>
  2035. is unset, or does not include a valid value,
  2036. all lines read by the shell parser are saved on the history list,
  2037. subject to the value of
  2038. <FONT SIZE=-1><B>HISTIGNORE</B>.
  2039. </FONT>
  2040. The second and subsequent lines of a multi-line compound command are
  2041. not tested, and are added to the history regardless of the value of
  2042. <FONT SIZE=-1><B>HISTCONTROL</B>.
  2043. </FONT>
  2044. <DT><B>HISTFILE</B>
  2045. <DD>
  2046. The name of the file in which command history is saved (see
  2047. <FONT SIZE=-1><B>HISTORY</B>
  2048. </FONT>
  2049. below). The default value is <A HREF="file:~/.bash_history"><I>~/.bash_history</I></A>. If unset, the
  2050. command history is not saved when a shell exits.
  2051. <DT><B>HISTFILESIZE</B>
  2052. <DD>
  2053. The maximum number of lines contained in the history file. When this
  2054. variable is assigned a value, the history file is truncated, if
  2055. necessary,
  2056. to contain no more than that number of lines by removing the oldest entries.
  2057. The history file is also truncated to this size after
  2058. writing it when a shell exits.
  2059. If the value is 0, the history file is truncated to zero size.
  2060. Non-numeric values and numeric values less than zero inhibit truncation.
  2061. The shell sets the default value to the value of <B>HISTSIZE</B>
  2062. after reading any startup files.
  2063. <DT><B>HISTIGNORE</B>
  2064. <DD>
  2065. A colon-separated list of patterns used to decide which command lines
  2066. should be saved on the history list. Each pattern is anchored at the
  2067. beginning of the line and must match the complete line (no implicit
  2068. `<B>*</B>' is appended). Each pattern is tested against the line
  2069. after the checks specified by
  2070. <FONT SIZE=-1><B>HISTCONTROL</B>
  2071. </FONT>
  2072. are applied.
  2073. In addition to the normal shell pattern matching characters, `<B>&amp;</B>'
  2074. matches the previous history line. `<B>&amp;</B>' may be escaped using a
  2075. backslash; the backslash is removed before attempting a match.
  2076. The second and subsequent lines of a multi-line compound command are
  2077. not tested, and are added to the history regardless of the value of
  2078. <FONT SIZE=-1><B>HISTIGNORE</B>.
  2079. </FONT>
  2080. The pattern matching honors the setting of the <B>extglob</B> shell
  2081. option.
  2082. <DT><B>HISTSIZE</B>
  2083. <DD>
  2084. The number of commands to remember in the command history (see
  2085. <FONT SIZE=-1><B>HISTORY</B>
  2086. </FONT>
  2087. below).
  2088. If the value is 0, commands are not saved in the history list.
  2089. Numeric values less than zero result in every command being saved
  2090. on the history list (there is no limit).
  2091. The shell sets the default value to 500 after reading any startup files.
  2092. <DT><B>HISTTIMEFORMAT</B>
  2093. <DD>
  2094. If this variable is set and not null, its value is used as a format string
  2095. for <I>strftime</I>(3) to print the time stamp associated with each history
  2096. entry displayed by the <B>history</B> builtin.
  2097. If this variable is set, time stamps are written to the history file so
  2098. they may be preserved across shell sessions.
  2099. This uses the history comment character to distinguish timestamps from
  2100. other history lines.
  2101. <DT><B>HOME</B>
  2102. <DD>
  2103. The home directory of the current user; the default argument for the
  2104. <B>cd</B> builtin command.
  2105. The value of this variable is also used when performing tilde expansion.
  2106. <DT><B>HOSTFILE</B>
  2107. <DD>
  2108. Contains the name of a file in the same format as
  2109. <I>/etc/hosts</I>
  2110. that should be read when the shell needs to complete a
  2111. hostname.
  2112. The list of possible hostname completions may be changed while the
  2113. shell is running;
  2114. the next time hostname completion is attempted after the
  2115. value is changed,
  2116. <B>bash</B>
  2117. adds the contents of the new file to the existing list.
  2118. If
  2119. <FONT SIZE=-1><B>HOSTFILE</B>
  2120. </FONT>
  2121. is set, but has no value, or does not name a readable file,
  2122. <B>bash</B> attempts to read
  2123. <I>/etc/hosts</I>
  2124. to obtain the list of possible hostname completions.
  2125. When
  2126. <FONT SIZE=-1><B>HOSTFILE</B>
  2127. </FONT>
  2128. is unset, the hostname list is cleared.
  2129. <DT><B>IFS</B>
  2130. <DD>
  2131. The
  2132. <I>Internal Field Separator</I>
  2133. that is used
  2134. for word splitting after expansion and to
  2135. split lines into words with the
  2136. <B>read</B>
  2137. builtin command. The default value is
  2138. ``&lt;space&gt;&lt;tab&gt;&lt;newline&gt;''.
  2139. <DT><B>IGNOREEOF</B>
  2140. <DD>
  2141. Controls the
  2142. action of an interactive shell on receipt of an
  2143. <FONT SIZE=-1><B>EOF</B>
  2144. </FONT>
  2145. character as the sole input. If set, the value is the number of
  2146. consecutive
  2147. <FONT SIZE=-1><B>EOF</B>
  2148. </FONT>
  2149. characters which must be
  2150. typed as the first characters on an input line before
  2151. <B>bash</B>
  2152. exits. If the variable exists but does not have a numeric value, or
  2153. has no value, the default value is 10. If it does not exist,
  2154. <FONT SIZE=-1><B>EOF</B>
  2155. </FONT>
  2156. signifies the end of input to the shell.
  2157. <DT><B>INPUTRC</B>
  2158. <DD>
  2159. The filename for the
  2160. <B>readline</B>
  2161. startup file, overriding the default of
  2162. <A HREF="file:~/.inputrc"><I>~/.inputrc</I></A>
  2163. (see
  2164. <FONT SIZE=-1><B>READLINE</B>
  2165. </FONT>
  2166. below).
  2167. <DT><B>LANG</B>
  2168. <DD>
  2169. Used to determine the locale category for any category not specifically
  2170. selected with a variable starting with <B>LC_</B>.
  2171. <DT><B>LC_ALL</B>
  2172. <DD>
  2173. This variable overrides the value of
  2174. <FONT SIZE=-1><B>LANG</B>
  2175. </FONT>
  2176. and any other
  2177. <B>LC_</B> variable specifying a locale category.
  2178. <DT><B>LC_COLLATE</B>
  2179. <DD>
  2180. This variable determines the collation order used when sorting the
  2181. results of pathname expansion, and determines the behavior of range
  2182. expressions, equivalence classes, and collating sequences within
  2183. pathname expansion and pattern matching.
  2184. <DT><B>LC_CTYPE</B>
  2185. <DD>
  2186. This variable determines the interpretation of characters and the
  2187. behavior of character classes within pathname expansion and pattern
  2188. matching.
  2189. <DT><B>LC_MESSAGES</B>
  2190. <DD>
  2191. This variable determines the locale used to translate double-quoted
  2192. strings preceded by a <B>$</B>.
  2193. <DT><B>LC_NUMERIC</B>
  2194. <DD>
  2195. This variable determines the locale category used for number formatting.
  2196. <DT><B>LC_TIME</B>
  2197. <DD>
  2198. This variable determines the locale category used for data and time
  2199. formatting.
  2200. <DT><B>LINES</B>
  2201. <DD>
  2202. Used by the <B>select</B> compound command to determine the column length
  2203. for printing selection lists.
  2204. Automatically set if the
  2205. <B>checkwinsize</B>
  2206. option is enabled or in an interactive shell upon receipt of a
  2207. <FONT SIZE=-1><B>SIGWINCH</B>.
  2208. </FONT>
  2209. <DT><B>MAIL</B>
  2210. <DD>
  2211. If this parameter is set to a file or directory name and the
  2212. <FONT SIZE=-1><B>MAILPATH</B>
  2213. </FONT>
  2214. variable is not set,
  2215. <B>bash</B>
  2216. informs the user of the arrival of mail in the specified file or
  2217. Maildir-format directory.
  2218. <DT><B>MAILCHECK</B>
  2219. <DD>
  2220. Specifies how
  2221. often (in seconds)
  2222. <B>bash</B>
  2223. checks for mail. The default is 60 seconds. When it is time to check
  2224. for mail, the shell does so before displaying the primary prompt.
  2225. If this variable is unset, or set to a value that is not a number
  2226. greater than or equal to zero, the shell disables mail checking.
  2227. <DT><B>MAILPATH</B>
  2228. <DD>
  2229. A colon-separated list of filenames to be checked for mail.
  2230. The message to be printed when mail arrives in a particular file
  2231. may be specified by separating the filename from the message with a `?'.
  2232. When used in the text of the message, <B>$_</B> expands to the name of
  2233. the current mailfile.
  2234. Example:
  2235. <DL COMPACT><DT><DD>
  2236. <P>
  2237. <B>MAILPATH</B>=aq/var/mail/bfox?&quot;You have mail&quot;:~/shell-mail?&quot;$_ has mail!&quot;aq
  2238. <P>
  2239. <B>Bash</B>
  2240. can be configured to supply
  2241. a default value for this variable (there is no value by default),
  2242. but the location of the user
  2243. mail files that it uses is system dependent (e.g., /var/mail/<B>$USER</B>).
  2244. </DL>
  2245. <DT><B>OPTERR</B>
  2246. <DD>
  2247. If set to the value 1,
  2248. <B>bash</B>
  2249. displays error messages generated by the
  2250. <B>getopts</B>
  2251. builtin command (see
  2252. <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
  2253. </FONT>
  2254. below).
  2255. <FONT SIZE=-1><B>OPTERR</B>
  2256. </FONT>
  2257. is initialized to 1 each time the shell is invoked or a shell
  2258. script is executed.
  2259. <DT><B>PATH</B>
  2260. <DD>
  2261. The search path for commands. It
  2262. is a colon-separated list of directories in which
  2263. the shell looks for commands (see
  2264. <FONT SIZE=-1><B>COMMAND EXECUTION</B>
  2265. </FONT>
  2266. below).
  2267. A zero-length (null) directory name in the value of
  2268. <FONT SIZE=-1><B>PATH</B>
  2269. </FONT>
  2270. indicates the current directory.
  2271. A null directory name may appear as two adjacent colons, or as an initial
  2272. or trailing colon.
  2273. The default path is system-dependent,
  2274. and is set by the administrator who installs
  2275. <B>bash</B>.
  2276. A common value is
  2277. <TT>/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin</TT>.
  2278. <DT><B>POSIXLY_CORRECT</B>
  2279. <DD>
  2280. If this variable is in the environment when <B>bash</B> starts, the shell
  2281. enters <I>posix mode</I> before reading the startup files, as if the
  2282. <B>--posix</B>
  2283. invocation option had been supplied. If it is set while the shell is
  2284. running, <B>bash</B> enables <I>posix mode</I>, as if the command
  2285. <TT>set -o posix</TT>
  2286. had been executed.
  2287. <DT><B>PROMPT_COMMAND</B>
  2288. <DD>
  2289. If set, the value is executed as a command prior to issuing each primary
  2290. prompt.
  2291. <DT><B>PROMPT_DIRTRIM</B>
  2292. <DD>
  2293. If set to a number greater than zero, the value is used as the number of
  2294. trailing directory components to retain when expanding the <B>\w</B> and
  2295. <B>\W</B> prompt string escapes (see
  2296. <FONT SIZE=-1><B>PROMPTING</B>
  2297. </FONT>
  2298. below). Characters removed are replaced with an ellipsis.
  2299. <DT><B>PS0</B>
  2300. <DD>
  2301. The value of this parameter is expanded (see
  2302. <FONT SIZE=-1><B>PROMPTING</B>
  2303. </FONT>
  2304. below) and displayed by interactive shells after reading a command
  2305. and before the command is executed.
  2306. <DT><B>PS1</B>
  2307. <DD>
  2308. The value of this parameter is expanded (see
  2309. <FONT SIZE=-1><B>PROMPTING</B>
  2310. </FONT>
  2311. below) and used as the primary prompt string. The default value is
  2312. ``<B>\s-\v\$ </B>''.
  2313. <DT><B>PS2</B>
  2314. <DD>
  2315. The value of this parameter is expanded as with
  2316. <FONT SIZE=-1><B>PS1</B>
  2317. </FONT>
  2318. and used as the secondary prompt string. The default is
  2319. ``<B>&gt; </B>''.
  2320. <DT><B>PS3</B>
  2321. <DD>
  2322. The value of this parameter is used as the prompt for the
  2323. <B>select</B>
  2324. command (see
  2325. <FONT SIZE=-1><B>SHELL GRAMMAR</B>
  2326. </FONT>
  2327. above).
  2328. <DT><B>PS4</B>
  2329. <DD>
  2330. The value of this parameter is expanded as with
  2331. <FONT SIZE=-1><B>PS1</B>
  2332. </FONT>
  2333. and the value is printed before each command
  2334. <B>bash</B>
  2335. displays during an execution trace. The first character of
  2336. <FONT SIZE=-1><B>PS4</B>
  2337. </FONT>
  2338. is replicated multiple times, as necessary, to indicate multiple
  2339. levels of indirection. The default is ``<B>+ </B>''.
  2340. <DT><B>SHELL</B>
  2341. <DD>
  2342. The full pathname to the shell is kept in this environment variable.
  2343. If it is not set when the shell starts,
  2344. <B>bash</B>
  2345. assigns to it the full pathname of the current user's login shell.
  2346. <DT><B>TIMEFORMAT</B>
  2347. <DD>
  2348. The value of this parameter is used as a format string specifying
  2349. how the timing information for pipelines prefixed with the
  2350. <B>time</B>
  2351. reserved word should be displayed.
  2352. The <B>%</B> character introduces an escape sequence that is
  2353. expanded to a time value or other information.
  2354. The escape sequences and their meanings are as follows; the
  2355. braces denote optional portions.
  2356. <P>
  2357. <DL COMPACT><DT><DD>
  2358. <DL COMPACT>
  2359. <DT><B>%%</B>
  2360. <DD>
  2361. A literal <B>%</B>.
  2362. <DT><B>%[</B><I>p</I>][l]R
  2363. <DD>
  2364. The elapsed time in seconds.
  2365. <DT><B>%[</B><I>p</I>][l]U
  2366. <DD>
  2367. The number of CPU seconds spent in user mode.
  2368. <DT><B>%[</B><I>p</I>][l]S
  2369. <DD>
  2370. The number of CPU seconds spent in system mode.
  2371. <DT><B>%P</B>
  2372. <DD>
  2373. The CPU percentage, computed as (%U + %S) / %R.
  2374. </DL></DL>
  2375. <DT><DD>
  2376. The optional <I>p</I> is a digit specifying the <I>precision</I>,
  2377. the number of fractional digits after a decimal point.
  2378. A value of 0 causes no decimal point or fraction to be output.
  2379. At most three places after the decimal point may be specified;
  2380. values of <I>p</I> greater than 3 are changed to 3.
  2381. If <I>p</I> is not specified, the value 3 is used.
  2382. <DT><DD>
  2383. The optional <B>l</B> specifies a longer format, including
  2384. minutes, of the form <I>MM</I>m<I>SS</I>.<I>FF</I>s.
  2385. The value of <I>p</I> determines whether or not the fraction is
  2386. included.
  2387. <DT><DD>
  2388. If this variable is not set, <B>bash</B> acts as if it had the
  2389. value <B>$aq\nreal\t%3lR\nuser\t%3lU\nsys\t%3lSaq</B>.
  2390. If the value is null, no timing information is displayed.
  2391. A trailing newline is added when the format string is displayed.
  2392. <DT><B>TMOUT</B>
  2393. <DD>
  2394. If set to a value greater than zero,
  2395. <FONT SIZE=-1><B>TMOUT</B>
  2396. </FONT>
  2397. is treated as the
  2398. default timeout for the <B>read</B> builtin.
  2399. The <B>select</B> command terminates if input does not arrive
  2400. after
  2401. <FONT SIZE=-1><B>TMOUT</B>
  2402. </FONT>
  2403. seconds when input is coming from a terminal.
  2404. In an interactive shell, the value is interpreted as the
  2405. number of seconds to wait for a line of input after issuing the
  2406. primary prompt.
  2407. <B>Bash</B>
  2408. terminates after waiting for that number of seconds if a complete
  2409. line of input does not arrive.
  2410. <DT><B>TMPDIR</B>
  2411. <DD>
  2412. If set, <B>bash</B> uses its value as the name of a directory in which
  2413. <B>bash</B> creates temporary files for the shell's use.
  2414. <DT><B>auto_resume</B>
  2415. <DD>
  2416. This variable controls how the shell interacts with the user and
  2417. job control. If this variable is set, single word simple
  2418. commands without redirections are treated as candidates for resumption
  2419. of an existing stopped job. There is no ambiguity allowed; if there is
  2420. more than one job beginning with the string typed, the job most recently
  2421. accessed is selected. The
  2422. <I>name</I>
  2423. of a stopped job, in this context, is the command line used to
  2424. start it.
  2425. If set to the value
  2426. <I>exact</I>,
  2427. the string supplied must match the name of a stopped job exactly;
  2428. if set to
  2429. <I>substring</I>,
  2430. the string supplied needs to match a substring of the name of a
  2431. stopped job. The
  2432. <I>substring</I>
  2433. value provides functionality analogous to the
  2434. <B>%?</B>
  2435. job identifier (see
  2436. <FONT SIZE=-1><B>JOB CONTROL</B>
  2437. </FONT>
  2438. below). If set to any other value, the supplied string must
  2439. be a prefix of a stopped job's name; this provides functionality
  2440. analogous to the <B>%</B><I>string</I> job identifier.
  2441. <DT><B>histchars</B>
  2442. <DD>
  2443. The two or three characters which control history expansion
  2444. and tokenization (see
  2445. <FONT SIZE=-1><B>HISTORY EXPANSION</B>
  2446. </FONT>
  2447. below). The first character is the <I>history expansion</I> character,
  2448. the character which signals the start of a history
  2449. expansion, normally `<B>!</B>'.
  2450. The second character is the <I>quick substitution</I>
  2451. character, which is used as shorthand for re-running the previous
  2452. command entered, substituting one string for another in the command.
  2453. The default is `<B>^</B>'.
  2454. The optional third character is the character
  2455. which indicates that the remainder of the line is a comment when found
  2456. as the first character of a word, normally `<B>#</B>'. The history
  2457. comment character causes history substitution to be skipped for the
  2458. remaining words on the line. It does not necessarily cause the shell
  2459. parser to treat the rest of the line as a comment.
  2460. </DL>
  2461. <A NAME="lbAX">&nbsp;</A>
  2462. <H4>Arrays</H4>
  2463. <B>Bash</B>
  2464. provides one-dimensional indexed and associative array variables.
  2465. Any variable may be used as an indexed array; the
  2466. <B>declare</B>
  2467. builtin will explicitly declare an array.
  2468. There is no maximum
  2469. limit on the size of an array, nor any requirement that members
  2470. be indexed or assigned contiguously.
  2471. Indexed arrays are referenced using integers (including arithmetic
  2472. expressions) and are zero-based; associative arrays are referenced
  2473. using arbitrary strings.
  2474. Unless otherwise noted, indexed array indices must be non-negative integers.
  2475. <P>
  2476. An indexed array is created automatically if any variable is assigned to
  2477. using the syntax <I>name</I>[<I>subscript</I>]=<I>value</I>. The
  2478. <I>subscript</I>
  2479. is treated as an arithmetic expression that must evaluate to a number.
  2480. To explicitly declare an indexed array, use
  2481. <B>declare -a </B><I>name</I>
  2482. (see
  2483. <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
  2484. </FONT>
  2485. below).
  2486. <B>declare -a </B><I>name</I>[<I>subscript</I>]
  2487. is also accepted; the <I>subscript</I> is ignored.
  2488. <P>
  2489. Associative arrays are created using
  2490. <B>declare -A </B><I>name</I>.
  2491. <P>
  2492. Attributes may be
  2493. specified for an array variable using the
  2494. <B>declare</B>
  2495. and
  2496. <B>readonly</B>
  2497. builtins. Each attribute applies to all members of an array.
  2498. <P>
  2499. Arrays are assigned to using compound assignments of the form
  2500. <I>name</I>=<B>(</B>value<I>1</I> ... value<I>n</I><B>)</B>, where each
  2501. <I>value</I> is of the form [<I>subscript</I>]=<I>string</I>.
  2502. Indexed array assignments do not require anything but <I>string</I>.
  2503. When assigning to indexed arrays, if the optional brackets and subscript
  2504. are supplied, that index is assigned to;
  2505. otherwise the index of the element assigned is the last index assigned
  2506. to by the statement plus one. Indexing starts at zero.
  2507. <P>
  2508. When assigning to an associative array, the subscript is required.
  2509. <P>
  2510. This syntax is also accepted by the
  2511. <B>declare</B>
  2512. builtin. Individual array elements may be assigned to using the
  2513. <I>name</I>[<I>subscript</I>]=<I>value</I> syntax introduced above.
  2514. When assigning to an indexed array, if
  2515. <I>name</I>
  2516. is subscripted by a negative number, that number is
  2517. interpreted as relative to one greater than the maximum index of
  2518. <I>name</I>, so negative indices count back from the end of the
  2519. array, and an index of -1 references the last element.
  2520. <P>
  2521. Any element of an array may be referenced using
  2522. ${<I>name</I>[<I>subscript</I>]}. The braces are required to avoid
  2523. conflicts with pathname expansion. If
  2524. <I>subscript</I> is <B>@</B> or <B>*</B>, the word expands to
  2525. all members of <I>name</I>. These subscripts differ only when the
  2526. word appears within double quotes. If the word is double-quoted,
  2527. ${<I>name</I>[*]} expands to a single
  2528. word with the value of each array member separated by the first
  2529. character of the
  2530. <FONT SIZE=-1><B>IFS</B>
  2531. </FONT>
  2532. special variable, and ${<I>name</I>[@]} expands each element of
  2533. <I>name</I> to a separate word. When there are no array members,
  2534. ${<I>name</I>[@]} expands to nothing.
  2535. If the double-quoted expansion occurs within a word, the expansion of
  2536. the first parameter is joined with the beginning part of the original
  2537. word, and the expansion of the last parameter is joined with the last
  2538. part of the original word.
  2539. This is analogous to the expansion
  2540. of the special parameters <B>*</B> and <B>@</B> (see
  2541. <B>Special Parameters</B>
  2542. above). ${#<I>name</I>[<I>subscript</I>]} expands to the length of
  2543. ${<I>name</I>[<I>subscript</I>]}. If <I>subscript</I> is <B>*</B> or
  2544. <B>@</B>, the expansion is the number of elements in the array.
  2545. If the
  2546. <I>subscript</I>
  2547. used to reference an element of an indexed array
  2548. evaluates to a number less than zero, it is
  2549. interpreted as relative to one greater than the maximum index of the array,
  2550. so negative indices count back from the end of the
  2551. array, and an index of -1 references the last element.
  2552. <P>
  2553. Referencing an array variable without a subscript is equivalent to
  2554. referencing the array with a subscript of 0.
  2555. Any reference to a variable using a valid subscript is legal, and
  2556. <B>bash</B>
  2557. will create an array if necessary.
  2558. <P>
  2559. An array variable is considered set if a subscript has been assigned a
  2560. value. The null string is a valid value.
  2561. <P>
  2562. It is possible to obtain the keys (indices) of an array as well as the values.
  2563. ${<B>!</B><I>name</I>[<I>@</I>]} and ${<B>!</B><I>name</I>[<I>*</I>]}
  2564. expand to the indices assigned in array variable <I>name</I>.
  2565. The treatment when in double quotes is similar to the expansion of the
  2566. special parameters <I>@</I> and <I>*</I> within double quotes.
  2567. <P>
  2568. The
  2569. <B>unset</B>
  2570. builtin is used to destroy arrays. <B>unset</B> <I>name</I>[<I>subscript</I>]
  2571. destroys the array element at index <I>subscript</I>.
  2572. Negative subscripts to indexed arrays are interpreted as described above.
  2573. Care must be taken to avoid unwanted side effects caused by pathname
  2574. expansion.
  2575. <B>unset</B> <I>name</I>, where <I>name</I> is an array, or
  2576. <B>unset</B> <I>name</I>[<I>subscript</I>], where
  2577. <I>subscript</I> is <B>*</B> or <B>@</B>, removes the entire array.
  2578. <P>
  2579. The
  2580. <B>declare</B>,
  2581. <B>local</B>,
  2582. and
  2583. <B>readonly</B>
  2584. builtins each accept a
  2585. <B>-a</B>
  2586. option to specify an indexed array and a
  2587. <B>-A</B>
  2588. option to specify an associative array.
  2589. If both options are supplied,
  2590. <B>-A</B>
  2591. takes precedence.
  2592. The
  2593. <B>read</B>
  2594. builtin accepts a
  2595. <B>-a</B>
  2596. option to assign a list of words read from the standard input
  2597. to an array. The
  2598. <B>set</B>
  2599. and
  2600. <B>declare</B>
  2601. builtins display array values in a way that allows them to be
  2602. reused as assignments.
  2603. <A NAME="lbAY">&nbsp;</A>
  2604. <H3>EXPANSION</H3>
  2605. Expansion is performed on the command line after it has been split into
  2606. words. There are seven kinds of expansion performed:
  2607. <I>brace expansion</I>,
  2608. <I>tilde expansion</I>,
  2609. <I>parameter and variable expansion</I>,
  2610. <I>command substitution</I>,
  2611. <I>arithmetic expansion</I>,
  2612. <I>word splitting</I>,
  2613. and
  2614. <I>pathname expansion</I>.
  2615. <P>
  2616. The order of expansions is:
  2617. brace expansion;
  2618. tilde expansion, parameter and variable expansion, arithmetic expansion,
  2619. and command substitution (done in a left-to-right fashion);
  2620. word splitting;
  2621. and pathname expansion.
  2622. <P>
  2623. On systems that can support it, there is an additional expansion
  2624. available: <I>process substitution</I>.
  2625. This is performed at the
  2626. same time as tilde, parameter, variable, and arithmetic expansion and
  2627. command substitution.
  2628. <P>
  2629. After these expansions are performed, quote characters present in the
  2630. original word are removed unless they have been quoted themselves
  2631. (<I>quote removal</I>).
  2632. <P>
  2633. Only brace expansion, word splitting, and pathname expansion
  2634. can change the number of words of the expansion; other expansions
  2635. expand a single word to a single word.
  2636. The only exceptions to this are the expansions of
  2637. &quot;<B>$@</B>&quot; and &quot;<B>${</B><I>name</I><B>[@]}</B>&quot;
  2638. as explained above (see
  2639. <FONT SIZE=-1><B>PARAMETERS</B>).
  2640. </FONT>
  2641. <A NAME="lbAZ">&nbsp;</A>
  2642. <H4>Brace Expansion</H4>
  2643. <P>
  2644. <I>Brace expansion</I>
  2645. is a mechanism by which arbitrary strings
  2646. may be generated. This mechanism is similar to
  2647. <I>pathname expansion</I>, but the filenames generated
  2648. need not exist. Patterns to be brace expanded take
  2649. the form of an optional
  2650. <I>preamble</I>,
  2651. followed by either a series of comma-separated strings or
  2652. a sequence expression between a pair of braces, followed by
  2653. an optional
  2654. <I>postscript</I>.
  2655. The preamble is prefixed to each string contained
  2656. within the braces, and the postscript is then appended
  2657. to each resulting string, expanding left to right.
  2658. <P>
  2659. Brace expansions may be nested. The results of each expanded
  2660. string are not sorted; left to right order is preserved.
  2661. For example, a<B>{</B>d,c,b<B>}</B>e expands into `ade ace abe'.
  2662. <P>
  2663. A sequence expression takes the form
  2664. <B>{</B><I>x</I><B>..</B><I>y</I><B>[..</B><I>incr</I><B>]}</B>,
  2665. where <I>x</I> and <I>y</I> are either integers or single characters,
  2666. and <I>incr</I>, an optional increment, is an integer.
  2667. When integers are supplied, the expression expands to each number between
  2668. <I>x</I> and <I>y</I>, inclusive.
  2669. Supplied integers may be prefixed with <I>0</I> to force each term to have the
  2670. same width.
  2671. When either <I>x</I> or y begins with a zero, the shell
  2672. attempts to force all generated terms to contain the same number of digits,
  2673. zero-padding where necessary.
  2674. When characters are supplied, the expression expands to each character
  2675. lexicographically between <I>x</I> and <I>y</I>, inclusive,
  2676. using the default C locale.
  2677. Note that both <I>x</I> and <I>y</I> must be of the same type.
  2678. When the increment is supplied, it is used as the difference between
  2679. each term. The default increment is 1 or -1 as appropriate.
  2680. <P>
  2681. Brace expansion is performed before any other expansions,
  2682. and any characters special to other expansions are preserved
  2683. in the result. It is strictly textual.
  2684. <B>Bash</B>
  2685. does not apply any syntactic interpretation to the context of the
  2686. expansion or the text between the braces.
  2687. <P>
  2688. A correctly-formed brace expansion must contain unquoted opening
  2689. and closing braces, and at least one unquoted comma or a valid
  2690. sequence expression.
  2691. Any incorrectly formed brace expansion is left unchanged.
  2692. A <B>{</B> or <B>,</B> may be quoted with a backslash to prevent its
  2693. being considered part of a brace expression.
  2694. To avoid conflicts with parameter expansion, the string <B>${</B>
  2695. is not considered eligible for brace expansion.
  2696. <P>
  2697. This construct is typically used as shorthand when the common
  2698. prefix of the strings to be generated is longer than in the
  2699. above example:
  2700. <DL COMPACT><DT><DD>
  2701. <P>
  2702. mkdir /usr/local/src/bash/{old,new,dist,bugs}
  2703. </DL>
  2704. or
  2705. <DL COMPACT><DT><DD>
  2706. chown root /usr/{ucb/{ex,edit},lib/{ex?.?*,how_ex}}
  2707. </DL>
  2708. <P>
  2709. Brace expansion introduces a slight incompatibility with
  2710. historical versions of
  2711. <B>sh</B>.
  2712. <B>sh</B>
  2713. does not treat opening or closing braces specially when they
  2714. appear as part of a word, and preserves them in the output.
  2715. <B>Bash</B>
  2716. removes braces from words as a consequence of brace
  2717. expansion. For example, a word entered to
  2718. <B>sh</B>
  2719. as <I>file{1,2}</I>
  2720. appears identically in the output. The same word is
  2721. output as
  2722. <I>file1 file2</I>
  2723. after expansion by
  2724. <B>bash</B>.
  2725. If strict compatibility with
  2726. <B>sh</B>
  2727. is desired, start
  2728. <B>bash</B>
  2729. with the
  2730. <B>+B</B>
  2731. option or disable brace expansion with the
  2732. <B>+B</B>
  2733. option to the
  2734. <B>set</B>
  2735. command (see
  2736. <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
  2737. </FONT>
  2738. below).
  2739. <A NAME="lbBA">&nbsp;</A>
  2740. <H4>Tilde Expansion</H4>
  2741. <P>
  2742. If a word begins with an unquoted tilde character (`<B>~</B>'), all of
  2743. the characters preceding the first unquoted slash (or all characters,
  2744. if there is no unquoted slash) are considered a <I>tilde-prefix</I>.
  2745. If none of the characters in the tilde-prefix are quoted, the
  2746. characters in the tilde-prefix following the tilde are treated as a
  2747. possible <I>login name</I>.
  2748. If this login name is the null string, the tilde is replaced with the
  2749. value of the shell parameter
  2750. <FONT SIZE=-1><B>HOME</B>.
  2751. </FONT>
  2752. If
  2753. <FONT SIZE=-1><B>HOME</B>
  2754. </FONT>
  2755. is unset, the home directory of the user executing the shell is
  2756. substituted instead.
  2757. Otherwise, the tilde-prefix is replaced with the home directory
  2758. associated with the specified login name.
  2759. <P>
  2760. If the tilde-prefix is a `~+', the value of the shell variable
  2761. <FONT SIZE=-1><B>PWD</B>
  2762. </FONT>
  2763. replaces the tilde-prefix.
  2764. If the tilde-prefix is a `~-', the value of the shell variable
  2765. <FONT SIZE=-1><B>OLDPWD</B>,
  2766. </FONT>
  2767. if it is set, is substituted.
  2768. If the characters following the tilde in the tilde-prefix consist
  2769. of a number <I>N</I>, optionally prefixed
  2770. by a `+' or a `-', the tilde-prefix is replaced with the corresponding
  2771. element from the directory stack, as it would be displayed by the
  2772. <B>dirs</B>
  2773. builtin invoked with the tilde-prefix as an argument.
  2774. If the characters following the tilde in the tilde-prefix consist of a
  2775. number without a leading `+' or `-', `+' is assumed.
  2776. <P>
  2777. If the login name is invalid, or the tilde expansion fails, the word
  2778. is unchanged.
  2779. <P>
  2780. Each variable assignment is checked for unquoted tilde-prefixes immediately
  2781. following a
  2782. <B>:</B>
  2783. or the first
  2784. <B>=</B>.
  2785. In these cases, tilde expansion is also performed.
  2786. Consequently, one may use filenames with tildes in assignments to
  2787. <FONT SIZE=-1><B>PATH</B>,
  2788. </FONT>
  2789. <FONT SIZE=-1><B>MAILPATH</B>,
  2790. </FONT>
  2791. and
  2792. <FONT SIZE=-1><B>CDPATH</B>,
  2793. </FONT>
  2794. and the shell assigns the expanded value.
  2795. <A NAME="lbBB">&nbsp;</A>
  2796. <H4>Parameter Expansion</H4>
  2797. <P>
  2798. The `<B>$</B>' character introduces parameter expansion,
  2799. command substitution, or arithmetic expansion. The parameter name
  2800. or symbol to be expanded may be enclosed in braces, which
  2801. are optional but serve to protect the variable to be expanded from
  2802. characters immediately following it which could be
  2803. interpreted as part of the name.
  2804. <P>
  2805. When braces are used, the matching ending brace is the first `<B>}</B>'
  2806. not escaped by a backslash or within a quoted string, and not within an
  2807. embedded arithmetic expansion, command substitution, or parameter
  2808. expansion.
  2809. <P>
  2810. <DL COMPACT>
  2811. <DT>${<I>parameter</I>}<DD>
  2812. The value of <I>parameter</I> is substituted. The braces are required
  2813. when
  2814. <I>parameter</I>
  2815. is a positional parameter with more than one digit,
  2816. or when
  2817. <I>parameter</I>
  2818. is followed by a character which is not to be
  2819. interpreted as part of its name.
  2820. The <I>parameter</I> is a shell parameter as described above
  2821. <B>PARAMETERS</B>) or an array reference (<B>Arrays</B>).
  2822. </DL>
  2823. <P>
  2824. If the first character of <I>parameter</I> is an exclamation point (<B>!</B>),
  2825. and <I>parameter</I> is not a <I>nameref</I>,
  2826. it introduces a level of variable indirection.
  2827. <B>Bash</B> uses the value of the variable formed from the rest of
  2828. <I>parameter</I> as the name of the variable; this variable is then
  2829. expanded and that value is used in the rest of the substitution, rather
  2830. than the value of <I>parameter</I> itself.
  2831. This is known as <I>indirect expansion</I>.
  2832. If <I>parameter</I> is a nameref, this expands to the name of the
  2833. variable referenced by <I>parameter</I> instead of performing the
  2834. complete indirect expansion.
  2835. The exceptions to this are the expansions of ${<B>!</B><I>prefix</I><B>*</B>} and
  2836. ${<B>!</B><I>name</I>[<I>@</I>]} described below.
  2837. The exclamation point must immediately follow the left brace in order to
  2838. introduce indirection.
  2839. <P>
  2840. In each of the cases below, <I>word</I> is subject to tilde expansion,
  2841. parameter expansion, command substitution, and arithmetic expansion.
  2842. <P>
  2843. When not performing substring expansion, using the forms documented below
  2844. (e.g., <B>:-</B>),
  2845. <B>bash</B> tests for a parameter that is unset or null. Omitting the colon
  2846. results in a test only for a parameter that is unset.
  2847. <P>
  2848. <DL COMPACT>
  2849. <DT>${<I>parameter</I><B>:-</B><I>word</I>}<DD>
  2850. <B>Use Default Values</B>. If
  2851. <I>parameter</I>
  2852. is unset or null, the expansion of
  2853. <I>word</I>
  2854. is substituted. Otherwise, the value of
  2855. <I>parameter</I>
  2856. is substituted.
  2857. <DT>${<I>parameter</I><B>:=</B><I>word</I>}<DD>
  2858. <B>Assign Default Values</B>.
  2859. If
  2860. <I>parameter</I>
  2861. is unset or null, the expansion of
  2862. <I>word</I>
  2863. is assigned to
  2864. <I>parameter</I>.
  2865. The value of
  2866. <I>parameter</I>
  2867. is then substituted. Positional parameters and special parameters may
  2868. not be assigned to in this way.
  2869. <DT>${<I>parameter</I><B>:?</B><I>word</I>}<DD>
  2870. <B>Display Error if Null or Unset</B>.
  2871. If
  2872. <I>parameter</I>
  2873. is null or unset, the expansion of <I>word</I> (or a message to that effect
  2874. if
  2875. <I>word</I>
  2876. is not present) is written to the standard error and the shell, if it
  2877. is not interactive, exits. Otherwise, the value of <I>parameter</I> is
  2878. substituted.
  2879. <DT>${<I>parameter</I><B>:+</B><I>word</I>}<DD>
  2880. <B>Use Alternate Value</B>.
  2881. If
  2882. <I>parameter</I>
  2883. is null or unset, nothing is substituted, otherwise the expansion of
  2884. <I>word</I>
  2885. is substituted.
  2886. <DT>${<I>parameter</I><B>:</B><I>offset</I>}<DD>
  2887. <DT>${<I>parameter</I><B>:</B><I>offset</I><B>:</B><I>length</I>}<DD>
  2888. <B>Substring Expansion</B>.
  2889. Expands to up to <I>length</I> characters of the value of <I>parameter</I>
  2890. starting at the character specified by <I>offset</I>.
  2891. If <I>parameter</I> is <B>@</B>, an indexed array subscripted by
  2892. <B>@</B> or <B>*</B>, or an associative array name, the results differ as
  2893. described below.
  2894. If <I>length</I> is omitted, expands to the substring of the value of
  2895. <I>parameter</I> starting at the character specified by <I>offset</I>
  2896. and extending to the end of the value.
  2897. <I>length</I> and <I>offset</I> are arithmetic expressions (see
  2898. <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>
  2899. </FONT>
  2900. below).
  2901. <P>
  2902. If <I>offset</I> evaluates to a number less than zero, the value
  2903. is used as an offset in characters
  2904. from the end of the value of <I>parameter</I>.
  2905. If <I>length</I> evaluates to a number less than zero,
  2906. it is interpreted as an offset in characters
  2907. from the end of the value of <I>parameter</I> rather than
  2908. a number of characters, and the expansion is the characters between
  2909. <I>offset</I> and that result.
  2910. Note that a negative offset must be separated from the colon by at least
  2911. one space to avoid being confused with the <B>:-</B> expansion.
  2912. <P>
  2913. If <I>parameter</I> is <B>@</B>, the result is <I>length</I> positional
  2914. parameters beginning at <I>offset</I>.
  2915. A negative <I>offset</I> is taken relative to one greater than the greatest
  2916. positional parameter, so an offset of -1 evaluates to the last positional
  2917. parameter.
  2918. It is an expansion error if <I>length</I> evaluates to a number less than
  2919. zero.
  2920. <P>
  2921. If <I>parameter</I> is an indexed array name subscripted by @ or *,
  2922. the result is the <I>length</I>
  2923. members of the array beginning with ${<I>parameter</I>[<I>offset</I>]}.
  2924. A negative <I>offset</I> is taken relative to one greater than the maximum
  2925. index of the specified array.
  2926. It is an expansion error if <I>length</I> evaluates to a number less than
  2927. zero.
  2928. <P>
  2929. Substring expansion applied to an associative array produces undefined
  2930. results.
  2931. <P>
  2932. Substring indexing is zero-based unless the positional parameters
  2933. are used, in which case the indexing starts at 1 by default.
  2934. If <I>offset</I> is 0, and the positional parameters are used, <B>$0</B> is
  2935. prefixed to the list.
  2936. <DT>${<B>!</B><I>prefix</I><B>*</B>}<DD>
  2937. <DT>${<B>!</B><I>prefix</I><B>@</B>}<DD>
  2938. <B>Names matching prefix</B>.
  2939. Expands to the names of variables whose names begin with <I>prefix</I>,
  2940. separated by the first character of the
  2941. <FONT SIZE=-1><B>IFS</B>
  2942. </FONT>
  2943. special variable.
  2944. When <I>@</I> is used and the expansion appears within double quotes, each
  2945. variable name expands to a separate word.
  2946. <DT>${<B>!</B><I>name</I>[<I>@</I>]}<DD>
  2947. <DT>${<B>!</B><I>name</I>[<I>*</I>]}<DD>
  2948. <B>List of array keys</B>.
  2949. If <I>name</I> is an array variable, expands to the list of array indices
  2950. (keys) assigned in <I>name</I>.
  2951. If <I>name</I> is not an array, expands to 0 if <I>name</I> is set and null
  2952. otherwise.
  2953. When <I>@</I> is used and the expansion appears within double quotes, each
  2954. key expands to a separate word.
  2955. <DT>${<B>#</B><I>parameter</I>}<DD>
  2956. <B>Parameter length</B>.
  2957. The length in characters of the value of <I>parameter</I> is substituted.
  2958. If
  2959. <I>parameter</I>
  2960. is
  2961. <B>*</B>
  2962. or
  2963. <B>@</B>,
  2964. the value substituted is the number of positional parameters.
  2965. If
  2966. <I>parameter</I>
  2967. is an array name subscripted by
  2968. <B>*</B>
  2969. or
  2970. <B>@</B>,
  2971. the value substituted is the number of elements in the array.
  2972. If
  2973. <I>parameter</I>
  2974. is an indexed array name subscripted by a negative number, that number is
  2975. interpreted as relative to one greater than the maximum index of
  2976. <I>parameter</I>, so negative indices count back from the end of the
  2977. array, and an index of -1 references the last element.
  2978. <DT>${<I>parameter</I><B>#</B><I>word</I>}<DD>
  2979. <DT>${<I>parameter</I><B>##</B><I>word</I>}<DD>
  2980. <B>Remove matching prefix pattern</B>.
  2981. The
  2982. <I>word</I>
  2983. is expanded to produce a pattern just as in pathname
  2984. expansion. If the pattern matches the beginning of
  2985. the value of
  2986. <I>parameter</I>,
  2987. then the result of the expansion is the expanded value of
  2988. <I>parameter</I>
  2989. with the shortest matching pattern (the ``<B>#</B>'' case) or the
  2990. longest matching pattern (the ``<B>##</B>'' case) deleted.
  2991. If
  2992. <I>parameter</I>
  2993. is
  2994. <B>@</B>
  2995. or
  2996. <B>*</B>,
  2997. the pattern removal operation is applied to each positional
  2998. parameter in turn, and the expansion is the resultant list.
  2999. If
  3000. <I>parameter</I>
  3001. is an array variable subscripted with
  3002. <B>@</B>
  3003. or
  3004. <B>*</B>,
  3005. the pattern removal operation is applied to each member of the
  3006. array in turn, and the expansion is the resultant list.
  3007. <DT>${<I>parameter</I><B>%</B><I>word</I>}<DD>
  3008. <DT>${<I>parameter</I><B>%%</B><I>word</I>}<DD>
  3009. <B>Remove matching suffix pattern</B>.
  3010. The <I>word</I> is expanded to produce a pattern just as in
  3011. pathname expansion.
  3012. If the pattern matches a trailing portion of the expanded value of
  3013. <I>parameter</I>,
  3014. then the result of the expansion is the expanded value of
  3015. <I>parameter</I>
  3016. with the shortest matching pattern (the ``<B>%</B>'' case) or the
  3017. longest matching pattern (the ``<B>%%</B>'' case) deleted.
  3018. If
  3019. <I>parameter</I>
  3020. is
  3021. <B>@</B>
  3022. or
  3023. <B>*</B>,
  3024. the pattern removal operation is applied to each positional
  3025. parameter in turn, and the expansion is the resultant list.
  3026. If
  3027. <I>parameter</I>
  3028. is an array variable subscripted with
  3029. <B>@</B>
  3030. or
  3031. <B>*</B>,
  3032. the pattern removal operation is applied to each member of the
  3033. array in turn, and the expansion is the resultant list.
  3034. <DT>${<I>parameter</I><B>/</B><I>pattern</I><B>/</B><I>string</I>}<DD>
  3035. <B>Pattern substitution</B>.
  3036. The <I>pattern</I> is expanded to produce a pattern just as in
  3037. pathname expansion.
  3038. <I>Parameter</I> is expanded and the longest match of <I>pattern</I>
  3039. against its value is replaced with <I>string</I>.
  3040. If <I>pattern</I> begins with <B>/</B>, all matches of <I>pattern</I> are
  3041. replaced with <I>string</I>. Normally only the first match is replaced.
  3042. If <I>pattern</I> begins with <B>#</B>, it must match at the beginning
  3043. of the expanded value of <I>parameter</I>.
  3044. If <I>pattern</I> begins with <B>%</B>, it must match at the end
  3045. of the expanded value of <I>parameter</I>.
  3046. If <I>string</I> is null, matches of <I>pattern</I> are deleted
  3047. and the <B>/</B> following <I>pattern</I> may be omitted.
  3048. If the
  3049. <B>nocasematch</B>
  3050. shell option is enabled, the match is performed without regard to the case
  3051. of alphabetic characters.
  3052. If
  3053. <I>parameter</I>
  3054. is
  3055. <B>@</B>
  3056. or
  3057. <B>*</B>,
  3058. the substitution operation is applied to each positional
  3059. parameter in turn, and the expansion is the resultant list.
  3060. If
  3061. <I>parameter</I>
  3062. is an array variable subscripted with
  3063. <B>@</B>
  3064. or
  3065. <B>*</B>,
  3066. the substitution operation is applied to each member of the
  3067. array in turn, and the expansion is the resultant list.
  3068. <DT>${<I>parameter</I><B>^</B><I>pattern</I>}<DD>
  3069. <DT>${<I>parameter</I><B>^^</B><I>pattern</I>}<DD>
  3070. <DT>${<I>parameter</I><B>,</B><I>pattern</I>}<DD>
  3071. <DT>${<I>parameter</I><B>,,</B><I>pattern</I>}<DD>
  3072. <B>Case modification</B>.
  3073. This expansion modifies the case of alphabetic characters in <I>parameter</I>.
  3074. The <I>pattern</I> is expanded to produce a pattern just as in
  3075. pathname expansion.
  3076. Each character in the expanded value of <I>parameter</I> is tested against
  3077. <I>pattern</I>, and, if it matches the pattern, its case is converted.
  3078. The pattern should not attempt to match more than one character.
  3079. The <B>^</B> operator converts lowercase letters matching <I>pattern</I>
  3080. to uppercase; the <B>,</B> operator converts matching uppercase letters
  3081. to lowercase.
  3082. The <B>^^</B> and <B>,,</B> expansions convert each matched character in the
  3083. expanded value; the <B>^</B> and <B>,</B> expansions match and convert only
  3084. the first character in the expanded value.
  3085. If <I>pattern</I> is omitted, it is treated like a <B>?</B>, which matches
  3086. every character.
  3087. If
  3088. <I>parameter</I>
  3089. is
  3090. <B>@</B>
  3091. or
  3092. <B>*</B>,
  3093. the case modification operation is applied to each positional
  3094. parameter in turn, and the expansion is the resultant list.
  3095. If
  3096. <I>parameter</I>
  3097. is an array variable subscripted with
  3098. <B>@</B>
  3099. or
  3100. <B>*</B>,
  3101. the case modification operation is applied to each member of the
  3102. array in turn, and the expansion is the resultant list.
  3103. <DT>${<I>parameter</I><B>@</B><I>operator</I>}<DD>
  3104. <B>Parameter transformation</B>.
  3105. The expansion is either a transformation of the value of <I>parameter</I>
  3106. or information about <I>parameter</I> itself, depending on the value of
  3107. <I>operator</I>. Each <I>operator</I> is a single letter:
  3108. <P>
  3109. <DL COMPACT><DT><DD>
  3110. <DL COMPACT>
  3111. <DT><B>Q</B>
  3112. <DD>
  3113. The expansion is a string that is the value of <I>parameter</I> quoted in a
  3114. format that can be reused as input.
  3115. <DT><B>E</B>
  3116. <DD>
  3117. The expansion is a string that is the value of <I>parameter</I> with backslash
  3118. escape sequences expanded as with the <B>$'...'</B> quoting mechansim.
  3119. <DT><B>P</B>
  3120. <DD>
  3121. The expansion is a string that is the result of expanding the value of
  3122. <I>parameter</I> as if it were a prompt string (see <B>PROMPTING</B> below).
  3123. <DT><B>A</B>
  3124. <DD>
  3125. The expansion is a string in the form of
  3126. an assignment statement or <B>declare</B> command that, if
  3127. evaluated, will recreate <I>parameter</I> with its attributes and value.
  3128. <DT><B>a</B>
  3129. <DD>
  3130. The expansion is a string consisting of flag values representing
  3131. <I>parameter</I>'s attributes.
  3132. </DL>
  3133. <P>
  3134. If
  3135. <I>parameter</I>
  3136. is
  3137. <B>@</B>
  3138. or
  3139. <B>*</B>,
  3140. the operation is applied to each positional
  3141. parameter in turn, and the expansion is the resultant list.
  3142. If
  3143. <I>parameter</I>
  3144. is an array variable subscripted with
  3145. <B>@</B>
  3146. or
  3147. <B>*</B>,
  3148. the case modification operation is applied to each member of the
  3149. array in turn, and the expansion is the resultant list.
  3150. <P>
  3151. The result of the expansion is subject to word splitting and pathname
  3152. expansion as described below.
  3153. </DL>
  3154. </DL>
  3155. <A NAME="lbBC">&nbsp;</A>
  3156. <H4>Command Substitution</H4>
  3157. <P>
  3158. <I>Command substitution</I> allows the output of a command to replace
  3159. the command name. There are two forms:
  3160. <DL COMPACT><DT><DD>
  3161. <P>
  3162. <B>$(</B><I>command</I><B>)</B>
  3163. </DL>
  3164. or
  3165. <DL COMPACT><DT><DD>
  3166. <B>`</B><I>command</I><B>`</B>
  3167. </DL>
  3168. <P>
  3169. <B>Bash</B>
  3170. performs the expansion by executing <I>command</I> in a subshell environment
  3171. and replacing the command substitution with the standard output of the
  3172. command, with any trailing newlines deleted.
  3173. Embedded newlines are not deleted, but they may be removed during
  3174. word splitting.
  3175. The command substitution <B>$(cat </B><I>file</I>) can be replaced by
  3176. the equivalent but faster <B>$(&lt; </B><I>file</I>).
  3177. <P>
  3178. When the old-style backquote form of substitution is used,
  3179. backslash retains its literal meaning except when followed by
  3180. <B>$</B>,
  3181. <B>`</B>,
  3182. or
  3183. <B>\</B>.
  3184. The first backquote not preceded by a backslash terminates the
  3185. command substitution.
  3186. When using the $(<I>command</I>) form, all characters between the
  3187. parentheses make up the command; none are treated specially.
  3188. <P>
  3189. Command substitutions may be nested. To nest when using the backquoted form,
  3190. escape the inner backquotes with backslashes.
  3191. <P>
  3192. If the substitution appears within double quotes, word splitting and
  3193. pathname expansion are not performed on the results.
  3194. <A NAME="lbBD">&nbsp;</A>
  3195. <H4>Arithmetic Expansion</H4>
  3196. <P>
  3197. Arithmetic expansion allows the evaluation of an arithmetic expression
  3198. and the substitution of the result. The format for arithmetic expansion is:
  3199. <DL COMPACT><DT><DD>
  3200. <P>
  3201. <B>$((</B><I>expression</I><B>))</B>
  3202. </DL>
  3203. <P>
  3204. The
  3205. <I>expression</I>
  3206. is treated as if it were within double quotes, but a double quote
  3207. inside the parentheses is not treated specially.
  3208. All tokens in the expression undergo parameter and variable expansion,
  3209. command substitution, and quote removal.
  3210. The result is treated as the arithmetic expression to be evaluated.
  3211. Arithmetic expansions may be nested.
  3212. <P>
  3213. The evaluation is performed according to the rules listed below under
  3214. <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>.
  3215. </FONT>
  3216. If
  3217. <I>expression</I>
  3218. is invalid,
  3219. <B>bash</B>
  3220. prints a message indicating failure and no substitution occurs.
  3221. <A NAME="lbBE">&nbsp;</A>
  3222. <H4>Process Substitution</H4>
  3223. <P>
  3224. <I>Process substitution</I> allows a process's input or output to be
  3225. referred to using a filename.
  3226. It takes the form of
  3227. <B>&lt;(</B><I>list</I><B>)</B>
  3228. or
  3229. <B>&gt;(</B><I>list</I><B>)</B>.
  3230. The process <I>list</I> is run asynchronously, and its input or output
  3231. appears as a filename.
  3232. This filename is
  3233. passed as an argument to the current command as the result of the
  3234. expansion.
  3235. If the <B>&gt;(</B><I>list</I><B>)</B> form is used, writing to
  3236. the file will provide input for <I>list</I>. If the
  3237. <B>&lt;(</B><I>list</I><B>)</B> form is used, the file passed as an
  3238. argument should be read to obtain the output of <I>list</I>.
  3239. Process substitution is supported on systems that support named
  3240. pipes (<I>FIFOs</I>) or the <B>/dev/fd</B> method of naming open files.
  3241. <P>
  3242. When available, process substitution is performed
  3243. simultaneously with parameter and variable expansion,
  3244. command substitution,
  3245. and arithmetic expansion.
  3246. <A NAME="lbBF">&nbsp;</A>
  3247. <H4>Word Splitting</H4>
  3248. <P>
  3249. The shell scans the results of
  3250. parameter expansion,
  3251. command substitution,
  3252. and
  3253. arithmetic expansion
  3254. that did not occur within double quotes for
  3255. <I>word splitting</I>.
  3256. <P>
  3257. The shell treats each character of
  3258. <FONT SIZE=-1><B>IFS</B>
  3259. </FONT>
  3260. as a delimiter, and splits the results of the other
  3261. expansions into words using these characters as field terminators.
  3262. If
  3263. <FONT SIZE=-1><B>IFS</B>
  3264. </FONT>
  3265. is unset, or its
  3266. value is exactly
  3267. <B>&lt;space&gt;&lt;tab&gt;&lt;newline&gt;</B>,
  3268. the default, then
  3269. sequences of
  3270. <B>&lt;space&gt;</B>,
  3271. <B>&lt;tab&gt;</B>,
  3272. and
  3273. <B>&lt;newline&gt;</B>
  3274. at the beginning and end of the results of the previous
  3275. expansions are ignored, and
  3276. any sequence of
  3277. <FONT SIZE=-1><B>IFS</B>
  3278. </FONT>
  3279. characters not at the beginning or end serves to delimit words.
  3280. If
  3281. <FONT SIZE=-1><B>IFS</B>
  3282. </FONT>
  3283. has a value other than the default, then sequences of
  3284. the whitespace characters
  3285. <B>space</B>,
  3286. <B>tab</B>,
  3287. and
  3288. <B>newline</B>
  3289. are ignored at the beginning and end of the
  3290. word, as long as the whitespace character is in the
  3291. value of
  3292. <FONT SIZE=-1><B>IFS</B>
  3293. </FONT>
  3294. (an
  3295. <FONT SIZE=-1><B>IFS</B>
  3296. </FONT>
  3297. whitespace character).
  3298. Any character in
  3299. <FONT SIZE=-1><B>IFS</B>
  3300. </FONT>
  3301. that is not
  3302. <FONT SIZE=-1><B>IFS</B>
  3303. </FONT>
  3304. whitespace, along with any adjacent
  3305. <FONT SIZE=-1><B>IFS</B>
  3306. </FONT>
  3307. whitespace characters, delimits a field.
  3308. A sequence of
  3309. <FONT SIZE=-1><B>IFS</B>
  3310. </FONT>
  3311. whitespace characters is also treated as a delimiter.
  3312. If the value of
  3313. <FONT SIZE=-1><B>IFS</B>
  3314. </FONT>
  3315. is null, no word splitting occurs.
  3316. <P>
  3317. Explicit null arguments (<B>&quot;&quot;</B> or <B>aqaq</B>) are retained
  3318. and passed to commands as empty strings.
  3319. Unquoted implicit null arguments, resulting from the expansion of
  3320. parameters that have no values, are removed.
  3321. If a parameter with no value is expanded within double quotes, a
  3322. null argument results and is retained
  3323. and passed to a command as an empty string.
  3324. When a quoted null argument appears as part of a word whose expansion is
  3325. non-null, the null argument is removed.
  3326. That is, the word
  3327. <TT>-daqaq</TT> becomes <TT>-d</TT> after word splitting and
  3328. null argument removal.
  3329. <P>
  3330. Note that if no expansion occurs, no splitting
  3331. is performed.
  3332. <A NAME="lbBG">&nbsp;</A>
  3333. <H4>Pathname Expansion</H4>
  3334. <P>
  3335. After word splitting,
  3336. unless the
  3337. <B>-f</B>
  3338. option has been set,
  3339. <B>bash</B>
  3340. scans each word for the characters
  3341. <B>*</B>,
  3342. <B>?</B>,
  3343. and
  3344. <B>[</B>.
  3345. If one of these characters appears, then the word is
  3346. regarded as a
  3347. <I>pattern</I>,
  3348. and replaced with an alphabetically sorted list of
  3349. filenames matching the pattern
  3350. (see
  3351. <FONT SIZE=-1><B>Pattern Matching</B>
  3352. </FONT>
  3353. below).
  3354. If no matching filenames are found,
  3355. and the shell option
  3356. <B>nullglob</B>
  3357. is not enabled, the word is left unchanged.
  3358. If the
  3359. <B>nullglob</B>
  3360. option is set, and no matches are found,
  3361. the word is removed.
  3362. If the
  3363. <B>failglob</B>
  3364. shell option is set, and no matches are found, an error message
  3365. is printed and the command is not executed.
  3366. If the shell option
  3367. <B>nocaseglob</B>
  3368. is enabled, the match is performed without regard to the case
  3369. of alphabetic characters.
  3370. When a pattern is used for pathname expansion,
  3371. the character
  3372. <B>``.''</B>
  3373. at the start of a name or immediately following a slash
  3374. must be matched explicitly, unless the shell option
  3375. <B>dotglob</B>
  3376. is set.
  3377. When matching a pathname, the slash character must always be
  3378. matched explicitly.
  3379. In other cases, the
  3380. <B>``.''</B>
  3381. character is not treated specially.
  3382. See the description of
  3383. <B>shopt</B>
  3384. below under
  3385. <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
  3386. </FONT>
  3387. for a description of the
  3388. <B>nocaseglob</B>,
  3389. <B>nullglob</B>,
  3390. <B>failglob</B>,
  3391. and
  3392. <B>dotglob</B>
  3393. shell options.
  3394. <P>
  3395. The
  3396. <FONT SIZE=-1><B>GLOBIGNORE</B>
  3397. </FONT>
  3398. shell variable may be used to restrict the set of filenames matching a
  3399. <I>pattern</I>.
  3400. If
  3401. <FONT SIZE=-1><B>GLOBIGNORE</B>
  3402. </FONT>
  3403. is set, each matching filename that also matches one of the patterns in
  3404. <FONT SIZE=-1><B>GLOBIGNORE</B>
  3405. </FONT>
  3406. is removed from the list of matches.
  3407. If the <B>nocaseglob</B> option is set, the matching against the patterns in
  3408. <FONT SIZE=-1><B>GLOBIGNORE</B>
  3409. </FONT>
  3410. is performed without regard to case.
  3411. The filenames
  3412. <B>``.''</B>
  3413. and
  3414. <B>``..''</B>
  3415. are always ignored when
  3416. <FONT SIZE=-1><B>GLOBIGNORE</B>
  3417. </FONT>
  3418. is set and not null. However, setting
  3419. <FONT SIZE=-1><B>GLOBIGNORE</B>
  3420. </FONT>
  3421. to a non-null value has the effect of enabling the
  3422. <B>dotglob</B>
  3423. shell option, so all other filenames beginning with a
  3424. <B>``.''</B>
  3425. will match.
  3426. To get the old behavior of ignoring filenames beginning with a
  3427. <B>``.''</B>,
  3428. make
  3429. <B>``.*''</B>
  3430. one of the patterns in
  3431. <FONT SIZE=-1><B>GLOBIGNORE</B>.
  3432. </FONT>
  3433. The
  3434. <B>dotglob</B>
  3435. option is disabled when
  3436. <FONT SIZE=-1><B>GLOBIGNORE</B>
  3437. </FONT>
  3438. is unset.
  3439. The pattern matching honors the setting of the <B>extglob</B> shell
  3440. option.
  3441. <P>
  3442. <B>Pattern Matching</B>
  3443. <P>
  3444. Any character that appears in a pattern, other than the special pattern
  3445. characters described below, matches itself. The NUL character may not
  3446. occur in a pattern. A backslash escapes the following character; the
  3447. escaping backslash is discarded when matching.
  3448. The special pattern characters must be quoted if
  3449. they are to be matched literally.
  3450. <P>
  3451. The special pattern characters have the following meanings:
  3452. <P>
  3453. <DL COMPACT><DT><DD>
  3454. <DL COMPACT>
  3455. <DT><B>*</B>
  3456. <DD>
  3457. Matches any string, including the null string.
  3458. When the <B>globstar</B> shell option is enabled, and <B>*</B> is used in
  3459. a pathname expansion context, two adjacent <B>*</B>s used as a single
  3460. pattern will match all files and zero or more directories and
  3461. subdirectories.
  3462. If followed by a <B>/</B>, two adjacent <B>*</B>s will match only directories
  3463. and subdirectories.
  3464. <DT><B>?</B>
  3465. <DD>
  3466. Matches any single character.
  3467. <DT><B>[...]</B>
  3468. <DD>
  3469. Matches any one of the enclosed characters. A pair of characters
  3470. separated by a hyphen denotes a
  3471. <I>range expression</I>;
  3472. any character that falls between those two characters, inclusive,
  3473. using the current locale's collating sequence and character set,
  3474. is matched. If the first character following the
  3475. <B>[</B>
  3476. is a
  3477. <B>!</B>
  3478. or a
  3479. <B>^</B>
  3480. then any character not enclosed is matched.
  3481. The sorting order of characters in range expressions is determined by
  3482. the current locale and the values of the
  3483. <FONT SIZE=-1><B>LC_COLLATE</B>
  3484. </FONT>
  3485. or
  3486. <FONT SIZE=-1><B>LC_ALL</B>
  3487. </FONT>
  3488. shell variables, if set.
  3489. To obtain the traditional interpretation of range expressions, where
  3490. <B>[a-d]</B>
  3491. is equivalent to
  3492. <B>[abcd]</B>,
  3493. set value of the
  3494. <B>LC_ALL</B>
  3495. shell variable to
  3496. <B>C</B>,
  3497. or enable the
  3498. <B>globasciiranges</B>
  3499. shell option.
  3500. A
  3501. <B>-</B>
  3502. may be matched by including it as the first or last character
  3503. in the set.
  3504. A
  3505. <B>]</B>
  3506. may be matched by including it as the first character
  3507. in the set.
  3508. <BR>
  3509. <P>
  3510. Within
  3511. <B>[</B>
  3512. and
  3513. <B>]</B>,
  3514. <I>character classes</I> can be specified using the syntax
  3515. <B>[:</B><I>class</I><B>:]</B>, where <I>class</I> is one of the
  3516. following classes defined in the POSIX standard:
  3517. </DL>
  3518. <P>
  3519. <DL COMPACT><DT><DD>
  3520. <B>
  3521. </B>
  3522. alnum alpha ascii blank cntrl digit graph lower print punct space upper word xdigit
  3523. <BR>
  3524. A character class matches any character belonging to that class.
  3525. The <B>word</B> character class matches letters, digits, and the character _.
  3526. <BR>
  3527. <P>
  3528. Within
  3529. <B>[</B>
  3530. and
  3531. <B>]</B>,
  3532. an <I>equivalence class</I> can be specified using the syntax
  3533. <B>[=</B><I>c</I><B>=]</B>, which matches all characters with the
  3534. same collation weight (as defined by the current locale) as
  3535. the character <I>c</I>.
  3536. <BR>
  3537. <P>
  3538. Within
  3539. <B>[</B>
  3540. and
  3541. <B>]</B>,
  3542. the syntax <B>[.</B><I>symbol</I><B>.]</B> matches the collating symbol
  3543. <I>symbol</I>.
  3544. </DL>
  3545. </DL>
  3546. <P>
  3547. If the <B>extglob</B> shell option is enabled using the <B>shopt</B>
  3548. builtin, several extended pattern matching operators are recognized.
  3549. In the following description, a <I>pattern-list</I> is a list of one
  3550. or more patterns separated by a <B>|</B>.
  3551. Composite patterns may be formed using one or more of the following
  3552. sub-patterns:
  3553. <P>
  3554. <DL COMPACT><DT><DD>
  3555. <DL COMPACT>
  3556. <DT><B>?(</B><I>pattern-list</I><B>)</B><DD>
  3557. Matches zero or one occurrence of the given patterns
  3558. <DT><B>*(</B><I>pattern-list</I><B>)</B><DD>
  3559. Matches zero or more occurrences of the given patterns
  3560. <DT><B>+(</B><I>pattern-list</I><B>)</B><DD>
  3561. Matches one or more occurrences of the given patterns
  3562. <DT><B>@(</B><I>pattern-list</I><B>)</B><DD>
  3563. Matches one of the given patterns
  3564. <DT><B>!(</B><I>pattern-list</I><B>)</B><DD>
  3565. Matches anything except one of the given patterns
  3566. </DL></DL>
  3567. <A NAME="lbBH">&nbsp;</A>
  3568. <H4>Quote Removal</H4>
  3569. <P>
  3570. After the preceding expansions, all unquoted occurrences of the
  3571. characters
  3572. <B>\</B>,
  3573. <B>aq</B>,
  3574. and <B>&quot;</B> that did not result from one of the above
  3575. expansions are removed.
  3576. <A NAME="lbBI">&nbsp;</A>
  3577. <H3>REDIRECTION</H3>
  3578. Before a command is executed, its input and output
  3579. may be
  3580. <I>redirected</I>
  3581. using a special notation interpreted by the shell.
  3582. Redirection allows commands' file handles to be
  3583. duplicated, opened, closed,
  3584. made to refer to different files,
  3585. and can change the files the command reads from and writes to.
  3586. Redirection may also be used to modify file handles in the
  3587. current shell execution environment.
  3588. The following redirection
  3589. operators may precede or appear anywhere within a
  3590. <I>simple command</I>
  3591. or may follow a
  3592. <I>command</I>.
  3593. Redirections are processed in the order they appear, from
  3594. left to right.
  3595. <P>
  3596. Each redirection that may be preceded by a file descriptor number
  3597. may instead be preceded by a word of the form {<I>varname</I>}.
  3598. In this case, for each redirection operator except
  3599. &gt;&amp;- and &lt;&amp;-, the shell will allocate a file descriptor greater
  3600. than or equal to 10 and assign it to <I>varname</I>.
  3601. If &gt;&amp;- or &lt;&amp;- is preceded
  3602. by {<I>varname</I>}, the value of <I>varname</I> defines the file
  3603. descriptor to close.
  3604. <P>
  3605. In the following descriptions, if the file descriptor number is
  3606. omitted, and the first character of the redirection operator is
  3607. <B>&lt;</B>,
  3608. the redirection refers to the standard input (file descriptor
  3609. 0). If the first character of the redirection operator is
  3610. <B>&gt;</B>,
  3611. the redirection refers to the standard output (file descriptor
  3612. 1).
  3613. <P>
  3614. The word following the redirection operator in the following
  3615. descriptions, unless otherwise noted, is subjected to
  3616. brace expansion, tilde expansion, parameter and variable expansion,
  3617. command substitution, arithmetic expansion, quote removal,
  3618. pathname expansion, and word splitting.
  3619. If it expands to more than one word,
  3620. <B>bash</B>
  3621. reports an error.
  3622. <P>
  3623. Note that the order of redirections is significant. For example,
  3624. the command
  3625. <DL COMPACT><DT><DD>
  3626. <P>
  3627. ls <B>&gt;</B> dirlist 2<B>&gt;&amp;</B>1
  3628. </DL>
  3629. <P>
  3630. directs both standard output and standard error to the file
  3631. <I>dirlist</I>,
  3632. while the command
  3633. <DL COMPACT><DT><DD>
  3634. <P>
  3635. ls 2<B>&gt;&amp;</B>1 <B>&gt;</B> dirlist
  3636. </DL>
  3637. <P>
  3638. directs only the standard output to file
  3639. <I>dirlist</I>,
  3640. because the standard error was duplicated from the standard output
  3641. before the standard output was redirected to
  3642. <I>dirlist</I>.
  3643. <P>
  3644. <B>Bash</B> handles several filenames specially when they are used in
  3645. redirections, as described in the following table.
  3646. If the operating system on which <B>bash</B> is running provides these
  3647. special files, bash will use them; otherwise it will emulate them
  3648. internally with the behavior described below.
  3649. <DL COMPACT><DT><DD>
  3650. <P>
  3651. <DL COMPACT>
  3652. <DT><B>/dev/fd/</B><I>fd</I>
  3653. <DD>
  3654. If <I>fd</I> is a valid integer, file descriptor <I>fd</I> is duplicated.
  3655. <DT><B>/dev/stdin</B>
  3656. <DD>
  3657. File descriptor 0 is duplicated.
  3658. <DT><B>/dev/stdout</B>
  3659. <DD>
  3660. File descriptor 1 is duplicated.
  3661. <DT><B>/dev/stderr</B>
  3662. <DD>
  3663. File descriptor 2 is duplicated.
  3664. <DT><B>/dev/tcp/</B><I>host</I>/<I>port</I>
  3665. <DD>
  3666. If <I>host</I> is a valid hostname or Internet address, and <I>port</I>
  3667. is an integer port number or service name, <B>bash</B> attempts to open
  3668. the corresponding TCP socket.
  3669. <DT><B>/dev/udp/</B><I>host</I>/<I>port</I>
  3670. <DD>
  3671. If <I>host</I> is a valid hostname or Internet address, and <I>port</I>
  3672. is an integer port number or service name, <B>bash</B> attempts to open
  3673. the corresponding UDP socket.
  3674. </DL></DL>
  3675. <P>
  3676. A failure to open or create a file causes the redirection to fail.
  3677. <P>
  3678. Redirections using file descriptors greater than 9 should be used with
  3679. care, as they may conflict with file descriptors the shell uses
  3680. internally.
  3681. <A NAME="lbBJ">&nbsp;</A>
  3682. <H4>Redirecting Input</H4>
  3683. <P>
  3684. Redirection of input causes the file whose name results from
  3685. the expansion of
  3686. <I>word</I>
  3687. to be opened for reading on file descriptor
  3688. <I>n</I>,
  3689. or the standard input (file descriptor 0) if
  3690. <I>n</I>
  3691. is not specified.
  3692. <P>
  3693. The general format for redirecting input is:
  3694. <DL COMPACT><DT><DD>
  3695. <P>
  3696. [<I>n</I>]<B>&lt;</B><I>word</I>
  3697. </DL>
  3698. <A NAME="lbBK">&nbsp;</A>
  3699. <H4>Redirecting Output</H4>
  3700. <P>
  3701. Redirection of output causes the file whose name results from
  3702. the expansion of
  3703. <I>word</I>
  3704. to be opened for writing on file descriptor
  3705. <I>n</I>,
  3706. or the standard output (file descriptor 1) if
  3707. <I>n</I>
  3708. is not specified. If the file does not exist it is created;
  3709. if it does exist it is truncated to zero size.
  3710. <P>
  3711. The general format for redirecting output is:
  3712. <DL COMPACT><DT><DD>
  3713. <P>
  3714. [<I>n</I>]<B>&gt;</B><I>word</I>
  3715. </DL>
  3716. <P>
  3717. If the redirection operator is
  3718. <B>&gt;</B>,
  3719. and the
  3720. <B>noclobber</B>
  3721. option to the
  3722. <B>set</B>
  3723. builtin has been enabled, the redirection will fail if the file
  3724. whose name results from the expansion of <I>word</I> exists and is
  3725. a regular file.
  3726. If the redirection operator is
  3727. <B>&gt;|</B>,
  3728. or the redirection operator is
  3729. <B>&gt;</B>
  3730. and the
  3731. <B>noclobber</B>
  3732. option to the
  3733. <B>set</B>
  3734. builtin command is not enabled, the redirection is attempted even
  3735. if the file named by <I>word</I> exists.
  3736. <A NAME="lbBL">&nbsp;</A>
  3737. <H4>Appending Redirected Output</H4>
  3738. <P>
  3739. Redirection of output in this fashion
  3740. causes the file whose name results from
  3741. the expansion of
  3742. <I>word</I>
  3743. to be opened for appending on file descriptor
  3744. <I>n</I>,
  3745. or the standard output (file descriptor 1) if
  3746. <I>n</I>
  3747. is not specified. If the file does not exist it is created.
  3748. <P>
  3749. The general format for appending output is:
  3750. <DL COMPACT><DT><DD>
  3751. <P>
  3752. [<I>n</I>]<B>&gt;&gt;</B><I>word</I>
  3753. </DL>
  3754. <P>
  3755. <A NAME="lbBM">&nbsp;</A>
  3756. <H4>Redirecting Standard Output and Standard Error</H4>
  3757. <P>
  3758. This construct allows both the
  3759. standard output (file descriptor 1) and
  3760. the standard error output (file descriptor 2)
  3761. to be redirected to the file whose name is the
  3762. expansion of
  3763. <I>word</I>.
  3764. <P>
  3765. There are two formats for redirecting standard output and
  3766. standard error:
  3767. <DL COMPACT><DT><DD>
  3768. <P>
  3769. <B>&amp;&gt;</B><I>word</I>
  3770. </DL>
  3771. and
  3772. <DL COMPACT><DT><DD>
  3773. <B>&gt;&amp;</B><I>word</I>
  3774. </DL>
  3775. <P>
  3776. Of the two forms, the first is preferred.
  3777. This is semantically equivalent to
  3778. <DL COMPACT><DT><DD>
  3779. <P>
  3780. <B>&gt;</B><I>word</I> 2<B>&gt;&amp;</B>1
  3781. </DL>
  3782. <P>
  3783. When using the second form, <I>word</I> may not expand to a number or
  3784. <B>-</B>. If it does, other redirection operators apply
  3785. (see <B>Duplicating File Descriptors</B> below) for compatibility
  3786. reasons.
  3787. <A NAME="lbBN">&nbsp;</A>
  3788. <H4>Appending Standard Output and Standard Error</H4>
  3789. <P>
  3790. This construct allows both the
  3791. standard output (file descriptor 1) and
  3792. the standard error output (file descriptor 2)
  3793. to be appended to the file whose name is the
  3794. expansion of
  3795. <I>word</I>.
  3796. <P>
  3797. The format for appending standard output and standard error is:
  3798. <DL COMPACT><DT><DD>
  3799. <P>
  3800. <B>&amp;&gt;&gt;</B><I>word</I>
  3801. </DL>
  3802. <P>
  3803. This is semantically equivalent to
  3804. <DL COMPACT><DT><DD>
  3805. <P>
  3806. <B>&gt;&gt;</B><I>word</I> 2<B>&gt;&amp;</B>1
  3807. </DL>
  3808. <P>
  3809. (see <B>Duplicating File Descriptors</B> below).
  3810. <A NAME="lbBO">&nbsp;</A>
  3811. <H4>Here Documents</H4>
  3812. <P>
  3813. This type of redirection instructs the shell to read input from the
  3814. current source until a line containing only
  3815. <I>delimiter</I>
  3816. (with no trailing blanks)
  3817. is seen. All of
  3818. the lines read up to that point are then used as the standard
  3819. input (or file descriptor <I>n</I> if <I>n</I> is specified) for a command.
  3820. <P>
  3821. The format of here-documents is:
  3822. <DL COMPACT><DT><DD>
  3823. <P>
  3824. <PRE>
  3825. [<I>n</I>]<B>&lt;&lt;</B>[<B>-</B>]<I>word</I>
  3826. <I>here-document</I>
  3827. <I>delimiter</I>
  3828. </PRE>
  3829. </DL>
  3830. <P>
  3831. No parameter and variable expansion, command substitution,
  3832. arithmetic expansion, or pathname expansion is performed on
  3833. <I>word</I>.
  3834. If any part of
  3835. <I>word</I>
  3836. is quoted, the
  3837. <I>delimiter</I>
  3838. is the result of quote removal on
  3839. <I>word</I>,
  3840. and the lines in the here-document are not expanded.
  3841. If <I>word</I> is unquoted,
  3842. all lines of the here-document are subjected to
  3843. parameter expansion, command substitution, and arithmetic expansion,
  3844. the character sequence
  3845. <B>\&lt;newline&gt;</B>
  3846. is ignored, and
  3847. <B>\</B>
  3848. must be used to quote the characters
  3849. <B>\</B>,
  3850. <B>$</B>,
  3851. and
  3852. <B>`</B>.
  3853. <P>
  3854. If the redirection operator is
  3855. <B>&lt;&lt;-</B>,
  3856. then all leading tab characters are stripped from input lines and the
  3857. line containing
  3858. <I>delimiter</I>.
  3859. This allows
  3860. here-documents within shell scripts to be indented in a
  3861. natural fashion.
  3862. <A NAME="lbBP">&nbsp;</A>
  3863. <H4>Here Strings</H4>
  3864. A variant of here documents, the format is:
  3865. <DL COMPACT><DT><DD>
  3866. <P>
  3867. <PRE>
  3868. [<I>n</I>]<B>&lt;&lt;&lt;</B><I>word</I>
  3869. </PRE>
  3870. </DL>
  3871. <P>
  3872. The <I>word</I> undergoes
  3873. brace expansion, tilde expansion, parameter and variable expansion,
  3874. command substitution, arithmetic expansion, and quote removal.
  3875. Pathname expansion and word splitting are not performed.
  3876. The result is supplied as a single string, with a newline appended,
  3877. to the command on its
  3878. standard input (or file descriptor <I>n</I> if <I>n</I> is specified).
  3879. <A NAME="lbBQ">&nbsp;</A>
  3880. <H4>Duplicating File Descriptors</H4>
  3881. <P>
  3882. The redirection operator
  3883. <DL COMPACT><DT><DD>
  3884. <P>
  3885. [<I>n</I>]<B>&lt;&amp;</B><I>word</I>
  3886. </DL>
  3887. <P>
  3888. is used to duplicate input file descriptors.
  3889. If
  3890. <I>word</I>
  3891. expands to one or more digits, the file descriptor denoted by
  3892. <I>n</I>
  3893. is made to be a copy of that file descriptor.
  3894. If the digits in
  3895. <I>word</I>
  3896. do not specify a file descriptor open for input, a redirection error occurs.
  3897. If
  3898. <I>word</I>
  3899. evaluates to
  3900. <B>-</B>,
  3901. file descriptor
  3902. <I>n</I>
  3903. is closed. If
  3904. <I>n</I>
  3905. is not specified, the standard input (file descriptor 0) is used.
  3906. <P>
  3907. The operator
  3908. <DL COMPACT><DT><DD>
  3909. <P>
  3910. [<I>n</I>]<B>&gt;&amp;</B><I>word</I>
  3911. </DL>
  3912. <P>
  3913. is used similarly to duplicate output file descriptors. If
  3914. <I>n</I>
  3915. is not specified, the standard output (file descriptor 1) is used.
  3916. If the digits in
  3917. <I>word</I>
  3918. do not specify a file descriptor open for output, a redirection error occurs.
  3919. If
  3920. <I>word</I>
  3921. evaluates to
  3922. <B>-</B>,
  3923. file descriptor
  3924. <I>n</I>
  3925. is closed.
  3926. As a special case, if <I>n</I> is omitted, and <I>word</I> does not
  3927. expand to one or more digits or <B>-</B>, the standard output and standard
  3928. error are redirected as described previously.
  3929. <A NAME="lbBR">&nbsp;</A>
  3930. <H4>Moving File Descriptors</H4>
  3931. <P>
  3932. The redirection operator
  3933. <DL COMPACT><DT><DD>
  3934. <P>
  3935. [<I>n</I>]<B>&lt;&amp;</B><I>digit</I><B>-</B>
  3936. </DL>
  3937. <P>
  3938. moves the file descriptor <I>digit</I> to file descriptor
  3939. <I>n</I>,
  3940. or the standard input (file descriptor 0) if <I>n</I> is not specified.
  3941. <I>digit</I> is closed after being duplicated to <I>n</I>.
  3942. <P>
  3943. Similarly, the redirection operator
  3944. <DL COMPACT><DT><DD>
  3945. <P>
  3946. [<I>n</I>]<B>&gt;&amp;</B><I>digit</I><B>-</B>
  3947. </DL>
  3948. <P>
  3949. moves the file descriptor <I>digit</I> to file descriptor
  3950. <I>n</I>,
  3951. or the standard output (file descriptor 1) if <I>n</I> is not specified.
  3952. <A NAME="lbBS">&nbsp;</A>
  3953. <H4>Opening File Descriptors for Reading and Writing</H4>
  3954. <P>
  3955. The redirection operator
  3956. <DL COMPACT><DT><DD>
  3957. <P>
  3958. [<I>n</I>]<B>&lt;&gt;</B><I>word</I>
  3959. </DL>
  3960. <P>
  3961. causes the file whose name is the expansion of
  3962. <I>word</I>
  3963. to be opened for both reading and writing on file descriptor
  3964. <I>n</I>,
  3965. or on file descriptor 0 if
  3966. <I>n</I>
  3967. is not specified. If the file does not exist, it is created.
  3968. <A NAME="lbBT">&nbsp;</A>
  3969. <H3>ALIASES</H3>
  3970. <I>Aliases</I> allow a string to be substituted for a word when it is used
  3971. as the first word of a simple command.
  3972. The shell maintains a list of aliases that may be set and unset with the
  3973. <B>alias</B>
  3974. and
  3975. <B>unalias</B>
  3976. builtin commands (see
  3977. <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
  3978. </FONT>
  3979. below).
  3980. The first word of each simple command, if unquoted,
  3981. is checked to see if it has an
  3982. alias. If so, that word is replaced by the text of the alias.
  3983. The characters <B>/</B>, <B>$</B>, <B>`</B>, and <B>=</B> and
  3984. any of the shell <I>metacharacters</I> or quoting characters
  3985. listed above may not appear in an alias name.
  3986. The replacement text may contain any valid shell input,
  3987. including shell metacharacters.
  3988. The first word of the replacement text is tested
  3989. for aliases, but a word that is identical to an alias being expanded
  3990. is not expanded a second time.
  3991. This means that one may alias
  3992. <B>ls</B>
  3993. to
  3994. <B>ls -F</B>,
  3995. for instance, and
  3996. <B>bash</B>
  3997. does not try to recursively expand the replacement text.
  3998. If the last character of the alias value is a
  3999. <I>blank</I>,
  4000. then the next command
  4001. word following the alias is also checked for alias expansion.
  4002. <P>
  4003. Aliases are created and listed with the
  4004. <B>alias</B>
  4005. command, and removed with the
  4006. <B>unalias</B>
  4007. command.
  4008. <P>
  4009. There is no mechanism for using arguments in the replacement text.
  4010. If arguments are needed, a shell function should be used (see
  4011. <FONT SIZE=-1><B>FUNCTIONS</B>
  4012. </FONT>
  4013. below).
  4014. <P>
  4015. Aliases are not expanded when the shell is not interactive, unless
  4016. the
  4017. <B>expand_aliases</B>
  4018. shell option is set using
  4019. <B>shopt</B>
  4020. (see the description of
  4021. <B>shopt</B>
  4022. under
  4023. <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B></FONT>
  4024. below).
  4025. <P>
  4026. The rules concerning the definition and use of aliases are
  4027. somewhat confusing.
  4028. <B>Bash</B>
  4029. always reads at least one complete line
  4030. of input before executing any
  4031. of the commands on that line. Aliases are expanded when a
  4032. command is read, not when it is executed. Therefore, an
  4033. alias definition appearing on the same line as another
  4034. command does not take effect until the next line of input is read.
  4035. The commands following the alias definition
  4036. on that line are not affected by the new alias.
  4037. This behavior is also an issue when functions are executed.
  4038. Aliases are expanded when a function definition is read,
  4039. not when the function is executed, because a function definition
  4040. is itself a command. As a consequence, aliases
  4041. defined in a function are not available until after that
  4042. function is executed. To be safe, always put
  4043. alias definitions on a separate line, and do not use
  4044. <B>alias</B>
  4045. in compound commands.
  4046. <P>
  4047. For almost every purpose, aliases are superseded by
  4048. shell functions.
  4049. <A NAME="lbBU">&nbsp;</A>
  4050. <H3>FUNCTIONS</H3>
  4051. A shell function, defined as described above under
  4052. <FONT SIZE=-1><B>SHELL GRAMMAR</B>,
  4053. </FONT>
  4054. stores a series of commands for later execution.
  4055. When the name of a shell function is used as a simple command name,
  4056. the list of commands associated with that function name is executed.
  4057. Functions are executed in the context of the
  4058. current shell; no new process is created to interpret
  4059. them (contrast this with the execution of a shell script).
  4060. When a function is executed, the arguments to the
  4061. function become the positional parameters
  4062. during its execution.
  4063. The special parameter
  4064. <B>#</B>
  4065. is updated to reflect the change. Special parameter <B>0</B>
  4066. is unchanged.
  4067. The first element of the
  4068. <FONT SIZE=-1><B>FUNCNAME</B>
  4069. </FONT>
  4070. variable is set to the name of the function while the function
  4071. is executing.
  4072. <P>
  4073. All other aspects of the shell execution
  4074. environment are identical between a function and its caller
  4075. with these exceptions: the
  4076. <FONT SIZE=-1><B>DEBUG</B>
  4077. </FONT>
  4078. and
  4079. <B>RETURN</B>
  4080. traps (see the description of the
  4081. <B>trap</B>
  4082. builtin under
  4083. <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
  4084. </FONT>
  4085. below) are not inherited unless the function has been given the
  4086. <B>trace</B> attribute (see the description of the
  4087. <FONT SIZE=-1><B>declare</B>
  4088. </FONT>
  4089. builtin below) or the
  4090. <B>-o functrace</B> shell option has been enabled with
  4091. the <B>set</B> builtin
  4092. (in which case all functions inherit the <B>DEBUG</B> and <B>RETURN</B> traps),
  4093. and the
  4094. <FONT SIZE=-1><B>ERR</B>
  4095. </FONT>
  4096. trap is not inherited unless the <B>-o errtrace</B> shell option has
  4097. been enabled.
  4098. <P>
  4099. Variables local to the function may be declared with the
  4100. <B>local</B>
  4101. builtin command. Ordinarily, variables and their values
  4102. are shared between the function and its caller.
  4103. <P>
  4104. The <B>FUNCNEST</B> variable, if set to a numeric value greater
  4105. than 0, defines a maximum function nesting level. Function
  4106. invocations that exceed the limit cause the entire command to
  4107. abort.
  4108. <P>
  4109. If the builtin command
  4110. <B>return</B>
  4111. is executed in a function, the function completes and
  4112. execution resumes with the next command after the function
  4113. call.
  4114. Any command associated with the <B>RETURN</B> trap is executed
  4115. before execution resumes.
  4116. When a function completes, the values of the
  4117. positional parameters and the special parameter
  4118. <B>#</B>
  4119. are restored to the values they had prior to the function's
  4120. execution.
  4121. <P>
  4122. Function names and definitions may be listed with the
  4123. <B>-f</B>
  4124. option to the
  4125. <B>declare</B>
  4126. or
  4127. <B>typeset</B>
  4128. builtin commands. The
  4129. <B>-F</B>
  4130. option to
  4131. <B>declare</B>
  4132. or
  4133. <B>typeset</B>
  4134. will list the function names only
  4135. (and optionally the source file and line number, if the <B>extdebug</B>
  4136. shell option is enabled).
  4137. Functions may be exported so that subshells
  4138. automatically have them defined with the
  4139. <B>-f</B>
  4140. option to the
  4141. <B>export</B>
  4142. builtin.
  4143. A function definition may be deleted using the <B>-f</B> option to
  4144. the
  4145. <B>unset</B>
  4146. builtin.
  4147. Note that shell functions and variables with the same name may result
  4148. in multiple identically-named entries in the environment passed to the
  4149. shell's children.
  4150. Care should be taken in cases where this may cause a problem.
  4151. <P>
  4152. Functions may be recursive.
  4153. The <B>FUNCNEST</B> variable may be used to limit the depth of the
  4154. function call stack and restrict the number of function invocations.
  4155. By default, no limit is imposed on the number of recursive calls.
  4156. <A NAME="lbBV">&nbsp;</A>
  4157. <H3>ARITHMETIC EVALUATION</H3>
  4158. The shell allows arithmetic expressions to be evaluated, under
  4159. certain circumstances (see the <B>let</B> and <B>declare</B> builtin
  4160. commands, the <B>((</B> compound command, and <B>Arithmetic Expansion</B>).
  4161. Evaluation is done in fixed-width integers with no check for overflow,
  4162. though division by 0 is trapped and flagged as an error.
  4163. The operators and their precedence, associativity, and values
  4164. are the same as in the C language.
  4165. The following list of operators is grouped into levels of
  4166. equal-precedence operators.
  4167. The levels are listed in order of decreasing precedence.
  4168. <P>
  4169. <DL COMPACT>
  4170. <DT><B></B><I>id</I>++ <I>id</I>--
  4171. <DD>
  4172. variable post-increment and post-decrement
  4173. <DT><B>++</B><I>id</I> --<I>id</I>
  4174. <DD>
  4175. variable pre-increment and pre-decrement
  4176. <DT><B>- +</B>
  4177. <DD>
  4178. unary minus and plus
  4179. <DT><B>! ~</B>
  4180. <DD>
  4181. logical and bitwise negation
  4182. <DT><B>**</B>
  4183. <DD>
  4184. exponentiation
  4185. <DT><B>* / %</B>
  4186. <DD>
  4187. multiplication, division, remainder
  4188. <DT><B>+ -</B>
  4189. <DD>
  4190. addition, subtraction
  4191. <DT><B>&lt;&lt; &gt;&gt;</B>
  4192. <DD>
  4193. left and right bitwise shifts
  4194. <DT><B>&lt;= &gt;= &lt; &gt;</B>
  4195. <DD>
  4196. comparison
  4197. <DT><B>== !=</B>
  4198. <DD>
  4199. equality and inequality
  4200. <DT><B>&amp;</B>
  4201. <DD>
  4202. bitwise AND
  4203. <DT><B>^</B>
  4204. <DD>
  4205. bitwise exclusive OR
  4206. <DT><B>|</B>
  4207. <DD>
  4208. bitwise OR
  4209. <DT><B>&amp;&amp;</B>
  4210. <DD>
  4211. logical AND
  4212. <DT><B>||</B>
  4213. <DD>
  4214. logical OR
  4215. <DT><B></B><I>expr</I>?<I>expr</I>:<I>expr</I>
  4216. <DD>
  4217. conditional operator
  4218. <DT><B>= *= /= %= += -= &lt;&lt;= &gt;&gt;= &amp;= ^= |=</B>
  4219. <DD>
  4220. assignment
  4221. <DT><B></B><I>expr1</I> , <I>expr2</I>
  4222. <DD>
  4223. comma
  4224. </DL>
  4225. <P>
  4226. Shell variables are allowed as operands; parameter expansion is
  4227. performed before the expression is evaluated.
  4228. Within an expression, shell variables may also be referenced by name
  4229. without using the parameter expansion syntax.
  4230. A shell variable that is null or unset evaluates to 0 when referenced
  4231. by name without using the parameter expansion syntax.
  4232. The value of a variable is evaluated as an arithmetic expression
  4233. when it is referenced, or when a variable which has been given the
  4234. <I>integer</I> attribute using <B>declare -i</B> is assigned a value.
  4235. A null value evaluates to 0.
  4236. A shell variable need not have its <I>integer</I> attribute
  4237. turned on to be used in an expression.
  4238. <P>
  4239. Constants with a leading 0 are interpreted as octal numbers.
  4240. A leading 0x or 0X denotes hexadecimal.
  4241. Otherwise, numbers take the form [<I>base#</I>]n, where the optional <I>base</I>
  4242. is a decimal number between 2 and 64 representing the arithmetic
  4243. base, and <I>n</I> is a number in that base.
  4244. If <I>base#</I> is omitted, then base 10 is used.
  4245. When specifying <I>n</I>,
  4246. the digits greater than 9 are represented by the lowercase letters,
  4247. the uppercase letters, @, and _, in that order.
  4248. If <I>base</I> is less than or equal to 36, lowercase and uppercase
  4249. letters may be used interchangeably to represent numbers between 10
  4250. and 35.
  4251. <P>
  4252. Operators are evaluated in order of precedence. Sub-expressions in
  4253. parentheses are evaluated first and may override the precedence
  4254. rules above.
  4255. <A NAME="lbBW">&nbsp;</A>
  4256. <H3>CONDITIONAL EXPRESSIONS</H3>
  4257. Conditional expressions are used by the <B>[[</B> compound command and
  4258. the <B>test</B> and <B>[</B> builtin commands to test file attributes
  4259. and perform string and arithmetic comparisons.
  4260. Expressions are formed from the following unary or binary primaries.
  4261. <B>Bash</B> handles several filenames specially when they are used in
  4262. expressions.
  4263. If the operating system on which <B>bash</B> is running provides these
  4264. special files, bash will use them; otherwise it will emulate them
  4265. internally with this behavior:
  4266. If any <I>file</I> argument to one of the primaries is of the form
  4267. <I>/dev/fd/n</I>, then file descriptor <I>n</I> is checked.
  4268. If the <I>file</I> argument to one of the primaries is one of
  4269. <I>/dev/stdin</I>, <I>/dev/stdout</I>, or <I>/dev/stderr</I>, file
  4270. descriptor 0, 1, or 2, respectively, is checked.
  4271. <P>
  4272. Unless otherwise specified, primaries that operate on files follow symbolic
  4273. links and operate on the target of the link, rather than the link itself.
  4274. <P>
  4275. When used with <B>[[</B>, the <B>&lt;</B> and <B>&gt;</B> operators sort
  4276. lexicographically using the current locale.
  4277. The <B>test</B> command sorts using ASCII ordering.
  4278. <P>
  4279. <DL COMPACT>
  4280. <DT><B>-a </B><I>file</I>
  4281. <DD>
  4282. True if <I>file</I> exists.
  4283. <DT><B>-b </B><I>file</I>
  4284. <DD>
  4285. True if <I>file</I> exists and is a block special file.
  4286. <DT><B>-c </B><I>file</I>
  4287. <DD>
  4288. True if <I>file</I> exists and is a character special file.
  4289. <DT><B>-d </B><I>file</I>
  4290. <DD>
  4291. True if <I>file</I> exists and is a directory.
  4292. <DT><B>-e </B><I>file</I>
  4293. <DD>
  4294. True if <I>file</I> exists.
  4295. <DT><B>-f </B><I>file</I>
  4296. <DD>
  4297. True if <I>file</I> exists and is a regular file.
  4298. <DT><B>-g </B><I>file</I>
  4299. <DD>
  4300. True if <I>file</I> exists and is set-group-id.
  4301. <DT><B>-h </B><I>file</I>
  4302. <DD>
  4303. True if <I>file</I> exists and is a symbolic link.
  4304. <DT><B>-k </B><I>file</I>
  4305. <DD>
  4306. True if <I>file</I> exists and its ``sticky'' bit is set.
  4307. <DT><B>-p </B><I>file</I>
  4308. <DD>
  4309. True if <I>file</I> exists and is a named pipe (FIFO).
  4310. <DT><B>-r </B><I>file</I>
  4311. <DD>
  4312. True if <I>file</I> exists and is readable.
  4313. <DT><B>-s </B><I>file</I>
  4314. <DD>
  4315. True if <I>file</I> exists and has a size greater than zero.
  4316. <DT><B>-t </B><I>fd</I>
  4317. <DD>
  4318. True if file descriptor
  4319. <I>fd</I>
  4320. is open and refers to a terminal.
  4321. <DT><B>-u </B><I>file</I>
  4322. <DD>
  4323. True if <I>file</I> exists and its set-user-id bit is set.
  4324. <DT><B>-w </B><I>file</I>
  4325. <DD>
  4326. True if <I>file</I> exists and is writable.
  4327. <DT><B>-x </B><I>file</I>
  4328. <DD>
  4329. True if <I>file</I> exists and is executable.
  4330. <DT><B>-G </B><I>file</I>
  4331. <DD>
  4332. True if <I>file</I> exists and is owned by the effective group id.
  4333. <DT><B>-L </B><I>file</I>
  4334. <DD>
  4335. True if <I>file</I> exists and is a symbolic link.
  4336. <DT><B>-N </B><I>file</I>
  4337. <DD>
  4338. True if <I>file</I> exists and has been modified since it was last read.
  4339. <DT><B>-O </B><I>file</I>
  4340. <DD>
  4341. True if <I>file</I> exists and is owned by the effective user id.
  4342. <DT><B>-S </B><I>file</I>
  4343. <DD>
  4344. True if <I>file</I> exists and is a socket.
  4345. <DT><I>file1</I> <B>-ef</B> <I>file2</I><DD>
  4346. True if <I>file1</I> and <I>file2</I> refer to the same device and
  4347. inode numbers.
  4348. <DT><I>file1</I> -<B>nt</B> <I>file2</I><DD>
  4349. True if <I>file1</I> is newer (according to modification date) than <I>file2</I>,
  4350. or if <I>file1</I> exists and file2 does not.
  4351. <DT><I>file1</I> -<B>ot</B> <I>file2</I><DD>
  4352. True if <I>file1</I> is older than <I>file2</I>, or if <I>file2</I> exists
  4353. and <I>file1</I> does not.
  4354. <DT><B>-o </B><I>optname</I>
  4355. <DD>
  4356. True if the shell option
  4357. <I>optname</I>
  4358. is enabled.
  4359. See the list of options under the description of the
  4360. <B>-o</B>
  4361. option to the
  4362. <B>set</B>
  4363. builtin below.
  4364. <DT><B>-v </B><I>varname</I>
  4365. <DD>
  4366. True if the shell variable
  4367. <I>varname</I>
  4368. is set (has been assigned a value).
  4369. <DT><B>-R </B><I>varname</I>
  4370. <DD>
  4371. True if the shell variable
  4372. <I>varname</I>
  4373. is set and is a name reference.
  4374. <DT><B>-z </B><I>string</I>
  4375. <DD>
  4376. True if the length of <I>string</I> is zero.
  4377. <DT><I>string</I><DD>
  4378. <DT><B>-n </B><I>string</I>
  4379. <DD>
  4380. True if the length of
  4381. <I>string</I>
  4382. is non-zero.
  4383. <DT><I>string1</I> <B>==</B> <I>string2</I><DD>
  4384. <DT><I>string1</I> <B>=</B> <I>string2</I><DD>
  4385. True if the strings are equal. <B>=</B> should be used
  4386. with the <B>test</B> command for POSIX conformance.
  4387. When used with the <B>[[</B> command, this performs pattern matching as
  4388. described above (<B>Compound Commands</B>).
  4389. <DT><I>string1</I> <B>!=</B> <I>string2</I><DD>
  4390. True if the strings are not equal.
  4391. <DT><I>string1</I> <B>&lt;</B> <I>string2</I><DD>
  4392. True if <I>string1</I> sorts before <I>string2</I> lexicographically.
  4393. <DT><I>string1</I> <B>&gt;</B> <I>string2</I><DD>
  4394. True if <I>string1</I> sorts after <I>string2</I> lexicographically.
  4395. <DT><I>arg1</I> <B>OP</B> <I>arg2</I>
  4396. <DD>
  4397. <FONT SIZE=-1><B>OP</B>
  4398. </FONT>
  4399. is one of
  4400. <B>-eq</B>,
  4401. <B>-ne</B>,
  4402. <B>-lt</B>,
  4403. <B>-le</B>,
  4404. <B>-gt</B>,
  4405. or
  4406. <B>-ge</B>.
  4407. These arithmetic binary operators return true if <I>arg1</I>
  4408. is equal to, not equal to, less than, less than or equal to,
  4409. greater than, or greater than or equal to <I>arg2</I>, respectively.
  4410. <I>Arg1</I>
  4411. and
  4412. <I>arg2</I>
  4413. may be positive or negative integers.
  4414. </DL>
  4415. <A NAME="lbBX">&nbsp;</A>
  4416. <H3>SIMPLE COMMAND EXPANSION</H3>
  4417. When a simple command is executed, the shell performs the following
  4418. expansions, assignments, and redirections, from left to right.
  4419. <DL COMPACT>
  4420. <DT>1.<DD>
  4421. The words that the parser has marked as variable assignments (those
  4422. preceding the command name) and redirections are saved for later
  4423. processing.
  4424. <DT>2.<DD>
  4425. The words that are not variable assignments or redirections are
  4426. expanded. If any words remain after expansion, the first word
  4427. is taken to be the name of the command and the remaining words are
  4428. the arguments.
  4429. <DT>3.<DD>
  4430. Redirections are performed as described above under
  4431. <FONT SIZE=-1><B>REDIRECTION</B>.
  4432. </FONT>
  4433. <DT>4.<DD>
  4434. The text after the <B>=</B> in each variable assignment undergoes tilde
  4435. expansion, parameter expansion, command substitution, arithmetic expansion,
  4436. and quote removal before being assigned to the variable.
  4437. </DL>
  4438. <P>
  4439. If no command name results, the variable assignments affect the current
  4440. shell environment. Otherwise, the variables are added to the environment
  4441. of the executed command and do not affect the current shell environment.
  4442. If any of the assignments attempts to assign a value to a readonly variable,
  4443. an error occurs, and the command exits with a non-zero status.
  4444. <P>
  4445. If no command name results, redirections are performed, but do not
  4446. affect the current shell environment. A redirection error causes the
  4447. command to exit with a non-zero status.
  4448. <P>
  4449. If there is a command name left after expansion, execution proceeds as
  4450. described below. Otherwise, the command exits. If one of the expansions
  4451. contained a command substitution, the exit status of the command is
  4452. the exit status of the last command substitution performed. If there
  4453. were no command substitutions, the command exits with a status of zero.
  4454. <A NAME="lbBY">&nbsp;</A>
  4455. <H3>COMMAND EXECUTION</H3>
  4456. After a command has been split into words, if it results in a
  4457. simple command and an optional list of arguments, the following
  4458. actions are taken.
  4459. <P>
  4460. If the command name contains no slashes, the shell attempts to
  4461. locate it. If there exists a shell function by that name, that
  4462. function is invoked as described above in
  4463. <FONT SIZE=-1><B>FUNCTIONS</B>.
  4464. </FONT>
  4465. If the name does not match a function, the shell searches for
  4466. it in the list of shell builtins. If a match is found, that
  4467. builtin is invoked.
  4468. <P>
  4469. If the name is neither a shell function nor a builtin,
  4470. and contains no slashes,
  4471. <B>bash</B>
  4472. searches each element of the
  4473. <FONT SIZE=-1><B>PATH</B>
  4474. </FONT>
  4475. for a directory containing an executable file by that name.
  4476. <B>Bash</B>
  4477. uses a hash table to remember the full pathnames of executable
  4478. files (see
  4479. <B>hash</B>
  4480. under
  4481. <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
  4482. </FONT>
  4483. below).
  4484. A full search of the directories in
  4485. <FONT SIZE=-1><B>PATH</B>
  4486. </FONT>
  4487. is performed only if the command is not found in the hash table.
  4488. If the search is unsuccessful, the shell searches for a defined shell
  4489. function named <B>command_not_found_handle</B>.
  4490. If that function exists, it is invoked with the original command and
  4491. the original command's arguments as its arguments, and the function's
  4492. exit status becomes the exit status of the shell.
  4493. If that function is not defined, the shell prints an error
  4494. message and returns an exit status of 127.
  4495. <P>
  4496. If the search is successful, or if the command name contains
  4497. one or more slashes, the shell executes the named program in a
  4498. separate execution environment.
  4499. Argument 0 is set to the name given, and the remaining arguments
  4500. to the command are set to the arguments given, if any.
  4501. <P>
  4502. If this execution fails because the file is not in executable
  4503. format, and the file is not a directory, it is assumed to be
  4504. a <I>shell script</I>, a file
  4505. containing shell commands. A subshell is spawned to execute
  4506. it. This subshell reinitializes itself, so
  4507. that the effect is as if a new shell had been invoked
  4508. to handle the script, with the exception that the locations of
  4509. commands remembered by the parent (see
  4510. <B>hash</B>
  4511. below under
  4512. <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>)</FONT>
  4513. are retained by the child.
  4514. <P>
  4515. If the program is a file beginning with
  4516. <B>#!</B>,
  4517. the remainder of the first line specifies an interpreter
  4518. for the program. The shell executes the
  4519. specified interpreter on operating systems that do not
  4520. handle this executable format themselves. The arguments to the
  4521. interpreter consist of a single optional argument following the
  4522. interpreter name on the first line of the program, followed
  4523. by the name of the program, followed by the command
  4524. arguments, if any.
  4525. <A NAME="lbBZ">&nbsp;</A>
  4526. <H3>COMMAND EXECUTION ENVIRONMENT</H3>
  4527. The shell has an <I>execution environment</I>, which consists of the
  4528. following:
  4529. <DL COMPACT>
  4530. <DT>*<DD>
  4531. open files inherited by the shell at invocation, as modified by
  4532. redirections supplied to the <B>exec</B> builtin
  4533. <DT>*<DD>
  4534. the current working directory as set by <B>cd</B>, <B>pushd</B>, or
  4535. <B>popd</B>, or inherited by the shell at invocation
  4536. <DT>*<DD>
  4537. the file creation mode mask as set by <B>umask</B> or inherited from
  4538. the shell's parent
  4539. <DT>*<DD>
  4540. current traps set by <B>trap</B>
  4541. <DT>*<DD>
  4542. shell parameters that are set by variable assignment or with <B>set</B>
  4543. or inherited from the shell's parent in the environment
  4544. <DT>*<DD>
  4545. shell functions defined during execution or inherited from the shell's
  4546. parent in the environment
  4547. <DT>*<DD>
  4548. options enabled at invocation (either by default or with command-line
  4549. arguments) or by <B>set</B>
  4550. <DT>*<DD>
  4551. options enabled by <B>shopt</B>
  4552. <DT>*<DD>
  4553. shell aliases defined with <B>alias</B>
  4554. <DT>*<DD>
  4555. various process IDs, including those of background jobs, the value
  4556. of <B>$$</B>, and the value of
  4557. <FONT SIZE=-1><B>PPID</B>
  4558. </FONT>
  4559. </DL>
  4560. <P>
  4561. When a simple command other than a builtin or shell function
  4562. is to be executed, it
  4563. is invoked in a separate execution environment that consists of
  4564. the following. Unless otherwise noted, the values are inherited
  4565. from the shell.
  4566. <DL COMPACT>
  4567. <DT>*<DD>
  4568. the shell's open files, plus any modifications and additions specified
  4569. by redirections to the command
  4570. <DT>*<DD>
  4571. the current working directory
  4572. <DT>*<DD>
  4573. the file creation mode mask
  4574. <DT>*<DD>
  4575. shell variables and functions marked for export, along with variables
  4576. exported for the command, passed in the environment
  4577. <DT>*<DD>
  4578. traps caught by the shell are reset to the values inherited from the
  4579. shell's parent, and traps ignored by the shell are ignored
  4580. </DL>
  4581. <P>
  4582. A command invoked in this separate environment cannot affect the
  4583. shell's execution environment.
  4584. <P>
  4585. Command substitution, commands grouped with parentheses,
  4586. and asynchronous commands are invoked in a
  4587. subshell environment that is a duplicate of the shell environment,
  4588. except that traps caught by the shell are reset to the values
  4589. that the shell inherited from its parent at invocation. Builtin
  4590. commands that are invoked as part of a pipeline are also executed in a
  4591. subshell environment. Changes made to the subshell environment
  4592. cannot affect the shell's execution environment.
  4593. <P>
  4594. Subshells spawned to execute command substitutions inherit the value of
  4595. the <B>-e</B> option from the parent shell. When not in <I>posix</I> mode,
  4596. <B>bash</B> clears the <B>-e</B> option in such subshells.
  4597. <P>
  4598. If a command is followed by a <B>&amp;</B> and job control is not active, the
  4599. default standard input for the command is the empty file <I>/dev/null</I>.
  4600. Otherwise, the invoked command inherits the file descriptors of the calling
  4601. shell as modified by redirections.
  4602. <A NAME="lbCA">&nbsp;</A>
  4603. <H3>ENVIRONMENT</H3>
  4604. When a program is invoked it is given an array of strings
  4605. called the
  4606. <I>environment</I>.
  4607. This is a list of
  4608. <I>name</I>-<I>value</I> pairs, of the form
  4609. <I>name</I>=value.
  4610. <P>
  4611. The shell provides several ways to manipulate the environment.
  4612. On invocation, the shell scans its own environment and
  4613. creates a parameter for each name found, automatically marking
  4614. it for
  4615. <I>export</I>
  4616. to child processes. Executed commands inherit the environment.
  4617. The
  4618. <B>export</B>
  4619. and
  4620. <B>declare -x</B>
  4621. commands allow parameters and functions to be added to and
  4622. deleted from the environment. If the value of a parameter
  4623. in the environment is modified, the new value becomes part
  4624. of the environment, replacing the old. The environment
  4625. inherited by any executed command consists of the shell's
  4626. initial environment, whose values may be modified in the shell,
  4627. less any pairs removed by the
  4628. <B>unset</B>
  4629. command, plus any additions via the
  4630. <B>export</B>
  4631. and
  4632. <B>declare -x</B>
  4633. commands.
  4634. <P>
  4635. The environment for any
  4636. <I>simple command</I>
  4637. or function may be augmented temporarily by prefixing it with
  4638. parameter assignments, as described above in
  4639. <FONT SIZE=-1><B>PARAMETERS</B>.
  4640. </FONT>
  4641. These assignment statements affect only the environment seen
  4642. by that command.
  4643. <P>
  4644. If the
  4645. <B>-k</B>
  4646. option is set (see the
  4647. <B>set</B>
  4648. builtin command below), then
  4649. <I>all</I>
  4650. parameter assignments are placed in the environment for a command,
  4651. not just those that precede the command name.
  4652. <P>
  4653. When
  4654. <B>bash</B>
  4655. invokes an external command, the variable
  4656. <B>_</B>
  4657. is set to the full filename of the command and passed to that
  4658. command in its environment.
  4659. <A NAME="lbCB">&nbsp;</A>
  4660. <H3>EXIT STATUS</H3>
  4661. <P>
  4662. The exit status of an executed command is the value returned by the
  4663. <I>waitpid</I> system call or equivalent function. Exit statuses
  4664. fall between 0 and 255, though, as explained below, the shell may
  4665. use values above 125 specially. Exit statuses from shell builtins and
  4666. compound commands are also limited to this range. Under certain
  4667. circumstances, the shell will use special values to indicate specific
  4668. failure modes.
  4669. <P>
  4670. For the shell's purposes, a command which exits with a
  4671. zero exit status has succeeded. An exit status of zero
  4672. indicates success. A non-zero exit status indicates failure.
  4673. When a command terminates on a fatal signal <I>N</I>, <B>bash</B> uses
  4674. the value of 128+<I>N</I> as the exit status.
  4675. <P>
  4676. If a command is not found, the child process created to
  4677. execute it returns a status of 127. If a command is found
  4678. but is not executable, the return status is 126.
  4679. <P>
  4680. If a command fails because of an error during expansion or redirection,
  4681. the exit status is greater than zero.
  4682. <P>
  4683. Shell builtin commands return a status of 0 (<I>true</I>) if
  4684. successful, and non-zero (<I>false</I>) if an error occurs
  4685. while they execute.
  4686. All builtins return an exit status of 2 to indicate incorrect usage,
  4687. generally invalid options or missing arguments.
  4688. <P>
  4689. <B>Bash</B> itself returns the exit status of the last command
  4690. executed, unless a syntax error occurs, in which case it exits
  4691. with a non-zero value. See also the <B>exit</B> builtin
  4692. command below.
  4693. <A NAME="lbCC">&nbsp;</A>
  4694. <H3>SIGNALS</H3>
  4695. When <B>bash</B> is interactive, in the absence of any traps, it ignores
  4696. <FONT SIZE=-1><B>SIGTERM</B>
  4697. </FONT>
  4698. (so that <B>kill 0</B> does not kill an interactive shell),
  4699. and
  4700. <FONT SIZE=-1><B>SIGINT</B>
  4701. </FONT>
  4702. is caught and handled (so that the <B>wait</B> builtin is interruptible).
  4703. In all cases, <B>bash</B> ignores
  4704. <FONT SIZE=-1><B>SIGQUIT</B>.
  4705. </FONT>
  4706. If job control is in effect,
  4707. <B>bash</B>
  4708. ignores
  4709. <FONT SIZE=-1><B>SIGTTIN</B>,
  4710. </FONT>
  4711. <FONT SIZE=-1><B>SIGTTOU</B>,
  4712. </FONT>
  4713. and
  4714. <FONT SIZE=-1><B>SIGTSTP</B>.
  4715. </FONT>
  4716. <P>
  4717. Non-builtin commands run by <B>bash</B> have signal handlers
  4718. set to the values inherited by the shell from its parent.
  4719. When job control is not in effect, asynchronous commands
  4720. ignore
  4721. <FONT SIZE=-1><B>SIGINT</B>
  4722. </FONT>
  4723. and
  4724. <FONT SIZE=-1><B>SIGQUIT</B>
  4725. </FONT>
  4726. in addition to these inherited handlers.
  4727. Commands run as a result of command substitution ignore the
  4728. keyboard-generated job control signals
  4729. <FONT SIZE=-1><B>SIGTTIN</B>,
  4730. </FONT>
  4731. <FONT SIZE=-1><B>SIGTTOU</B>,
  4732. </FONT>
  4733. and
  4734. <FONT SIZE=-1><B>SIGTSTP</B>.
  4735. </FONT>
  4736. <P>
  4737. The shell exits by default upon receipt of a
  4738. <FONT SIZE=-1><B>SIGHUP</B>.
  4739. </FONT>
  4740. Before exiting, an interactive shell resends the
  4741. <FONT SIZE=-1><B>SIGHUP</B>
  4742. </FONT>
  4743. to all jobs, running or stopped.
  4744. Stopped jobs are sent
  4745. <FONT SIZE=-1><B>SIGCONT</B>
  4746. </FONT>
  4747. to ensure that they receive the
  4748. <FONT SIZE=-1><B>SIGHUP</B>.
  4749. </FONT>
  4750. To prevent the shell from
  4751. sending the signal to a particular job, it should be removed from the
  4752. jobs table with the
  4753. <B>disown</B>
  4754. builtin (see
  4755. <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
  4756. </FONT>
  4757. below) or marked
  4758. to not receive
  4759. <FONT SIZE=-1><B>SIGHUP</B>
  4760. </FONT>
  4761. using
  4762. <B>disown -h</B>.
  4763. <P>
  4764. If the
  4765. <B>huponexit</B>
  4766. shell option has been set with
  4767. <B>shopt</B>,
  4768. <B>bash</B>
  4769. sends a
  4770. <FONT SIZE=-1><B>SIGHUP</B>
  4771. </FONT>
  4772. to all jobs when an interactive login shell exits.
  4773. <P>
  4774. If <B>bash</B> is waiting for a command to complete and receives a signal
  4775. for which a trap has been set, the trap will not be executed until
  4776. the command completes.
  4777. When <B>bash</B> is waiting for an asynchronous command via the <B>wait</B>
  4778. builtin, the reception of a signal for which a trap has been set will
  4779. cause the <B>wait</B> builtin to return immediately with an exit status
  4780. greater than 128, immediately after which the trap is executed.
  4781. <A NAME="lbCD">&nbsp;</A>
  4782. <H3>JOB CONTROL</H3>
  4783. <I>Job control</I>
  4784. refers to the ability to selectively stop (<I>suspend</I>)
  4785. the execution of processes and continue (<I>resume</I>)
  4786. their execution at a later point. A user typically employs
  4787. this facility via an interactive interface supplied jointly
  4788. by the operating system kernel's terminal driver and
  4789. <B>bash</B>.
  4790. <P>
  4791. The shell associates a
  4792. <I>job</I>
  4793. with each pipeline. It keeps a table of currently executing
  4794. jobs, which may be listed with the
  4795. <B>jobs</B>
  4796. command. When
  4797. <B>bash</B>
  4798. starts a job asynchronously (in the
  4799. <I>background</I>),
  4800. it prints a line that looks like:
  4801. <DL COMPACT><DT><DD>
  4802. <P>
  4803. [1] 25647
  4804. </DL>
  4805. <P>
  4806. indicating that this job is job number 1 and that the process ID
  4807. of the last process in the pipeline associated with this job is 25647.
  4808. All of the processes in a single pipeline are members of the same job.
  4809. <B>Bash</B>
  4810. uses the
  4811. <I>job</I>
  4812. abstraction as the basis for job control.
  4813. <P>
  4814. To facilitate the implementation of the user interface to job
  4815. control, the operating system maintains the notion of a <I>current terminal
  4816. process group ID</I>. Members of this process group (processes whose
  4817. process group ID is equal to the current terminal process group ID)
  4818. receive keyboard-generated signals such as
  4819. <FONT SIZE=-1><B>SIGINT</B>.
  4820. </FONT>
  4821. These processes are said to be in the
  4822. <I>foreground</I>.
  4823. <I>Background</I>
  4824. processes are those whose process group ID differs from the terminal's;
  4825. such processes are immune to keyboard-generated signals.
  4826. Only foreground processes are allowed to read from or, if the
  4827. user so specifies with <TT>stty tostop</TT>, write to the
  4828. terminal.
  4829. Background processes which attempt to read from (write to when
  4830. <TT>stty tostop</TT> is in effect) the
  4831. terminal are sent a
  4832. <FONT SIZE=-1><B>SIGTTIN (SIGTTOU)</B>
  4833. </FONT>
  4834. signal by the kernel's terminal driver,
  4835. which, unless caught, suspends the process.
  4836. <P>
  4837. If the operating system on which
  4838. <B>bash</B>
  4839. is running supports
  4840. job control,
  4841. <B>bash</B>
  4842. contains facilities to use it.
  4843. Typing the
  4844. <I>suspend</I>
  4845. character (typically
  4846. <B>^Z</B>,
  4847. Control-Z) while a process is running
  4848. causes that process to be stopped and returns control to
  4849. <B>bash</B>.
  4850. Typing the
  4851. <I>delayed suspend</I>
  4852. character (typically
  4853. <B>^Y</B>,
  4854. Control-Y) causes the process to be stopped when it
  4855. attempts to read input from the terminal, and control to
  4856. be returned to
  4857. <B>bash</B>.
  4858. The user may then manipulate the state of this job, using the
  4859. <B>bg</B>
  4860. command to continue it in the background, the
  4861. <B>fg</B>
  4862. command to continue it in the foreground, or
  4863. the
  4864. <B>kill</B>
  4865. command to kill it. A <B>^Z</B> takes effect immediately,
  4866. and has the additional side effect of causing pending output
  4867. and typeahead to be discarded.
  4868. <P>
  4869. There are a number of ways to refer to a job in the shell.
  4870. The character
  4871. <B>%</B>
  4872. introduces a job specification (<I>jobspec</I>). Job number
  4873. <I>n</I>
  4874. may be referred to as
  4875. <B>%n</B>.
  4876. A job may also be referred to using a prefix of the name used to
  4877. start it, or using a substring that appears in its command line.
  4878. For example,
  4879. <B>%ce</B>
  4880. refers to a stopped
  4881. <B>ce</B>
  4882. job. If a prefix matches more than one job,
  4883. <B>bash</B>
  4884. reports an error. Using
  4885. <B>%?ce</B>,
  4886. on the other hand, refers to any job containing the string
  4887. <B>ce</B>
  4888. in its command line. If the substring matches more than one job,
  4889. <B>bash</B>
  4890. reports an error. The symbols
  4891. <B>%%</B>
  4892. and
  4893. <B>%+</B>
  4894. refer to the shell's notion of the
  4895. <I>current job</I>,
  4896. which is the last job stopped while it was in
  4897. the foreground or started in the background.
  4898. The
  4899. <I>previous job</I>
  4900. may be referenced using
  4901. <B>%-</B>.
  4902. If there is only a single job, <B>%+</B> and <B>%-</B> can both be used
  4903. to refer to that job.
  4904. In output pertaining to jobs (e.g., the output of the
  4905. <B>jobs</B>
  4906. command), the current job is always flagged with a
  4907. <B>+</B>,
  4908. and the previous job with a
  4909. <B>-</B>.
  4910. A single % (with no accompanying job specification) also refers to the
  4911. current job.
  4912. <P>
  4913. Simply naming a job can be used to bring it into the
  4914. foreground:
  4915. <B>%1</B>
  4916. is a synonym for
  4917. <B>``fg %1''</B>,
  4918. bringing job 1 from the background into the foreground.
  4919. Similarly,
  4920. <B>``%1 &amp;''</B>
  4921. resumes job 1 in the background, equivalent to
  4922. <B>``bg %1''</B>.
  4923. <P>
  4924. The shell learns immediately whenever a job changes state.
  4925. Normally,
  4926. <B>bash</B>
  4927. waits until it is about to print a prompt before reporting
  4928. changes in a job's status so as to not interrupt
  4929. any other output. If the
  4930. <B>-b</B>
  4931. option to the
  4932. <B>set</B>
  4933. builtin command
  4934. is enabled,
  4935. <B>bash</B>
  4936. reports such changes immediately.
  4937. Any trap on
  4938. <FONT SIZE=-1><B>SIGCHLD</B>
  4939. </FONT>
  4940. is executed for each child that exits.
  4941. <P>
  4942. If an attempt to exit
  4943. <B>bash</B>
  4944. is made while jobs are stopped (or, if the <B>checkjobs</B> shell option has
  4945. been enabled using the <B>shopt</B> builtin, running), the shell prints a
  4946. warning message, and, if the <B>checkjobs</B> option is enabled, lists the
  4947. jobs and their statuses.
  4948. The
  4949. <B>jobs</B>
  4950. command may then be used to inspect their status.
  4951. If a second attempt to exit is made without an intervening command,
  4952. the shell does not print another warning, and any stopped
  4953. jobs are terminated.
  4954. <A NAME="lbCE">&nbsp;</A>
  4955. <H3>PROMPTING</H3>
  4956. When executing interactively,
  4957. <B>bash</B>
  4958. displays the primary prompt
  4959. <FONT SIZE=-1><B>PS1</B>
  4960. </FONT>
  4961. when it is ready to read a command, and the secondary prompt
  4962. <FONT SIZE=-1><B>PS2</B>
  4963. </FONT>
  4964. when it needs more input to complete a command.
  4965. <B>Bash</B>
  4966. displays
  4967. <B>PS0</B>
  4968. after it reads a command but before executing it.
  4969. <B>Bash</B>
  4970. allows these prompt strings to be customized by inserting a number of
  4971. backslash-escaped special characters that are decoded as follows:
  4972. <DL COMPACT><DT><DD>
  4973. <DL COMPACT>
  4974. <DT><B>\a</B>
  4975. <DD>
  4976. an ASCII bell character (07)
  4977. <DT><B>\d</B>
  4978. <DD>
  4979. the date in &quot;Weekday Month Date&quot; format (e.g., &quot;Tue May 26&quot;)
  4980. <DT><B>\D{</B><I>format</I>}
  4981. <DD>
  4982. the <I>format</I> is passed to <I>strftime</I>(3) and the result is inserted
  4983. into the prompt string; an empty <I>format</I> results in a locale-specific
  4984. time representation. The braces are required
  4985. <DT><B>\e</B>
  4986. <DD>
  4987. an ASCII escape character (033)
  4988. <DT><B>\h</B>
  4989. <DD>
  4990. the hostname up to the first `.'
  4991. <DT><B>\H</B>
  4992. <DD>
  4993. the hostname
  4994. <DT><B>\j</B>
  4995. <DD>
  4996. the number of jobs currently managed by the shell
  4997. <DT><B>\l</B>
  4998. <DD>
  4999. the basename of the shell's terminal device name
  5000. <DT><B>\n</B>
  5001. <DD>
  5002. newline
  5003. <DT><B>\r</B>
  5004. <DD>
  5005. carriage return
  5006. <DT><B>\s</B>
  5007. <DD>
  5008. the name of the shell, the basename of
  5009. <B>$0</B>
  5010. (the portion following the final slash)
  5011. <DT><B>\t</B>
  5012. <DD>
  5013. the current time in 24-hour HH:MM:SS format
  5014. <DT><B>\T</B>
  5015. <DD>
  5016. the current time in 12-hour HH:MM:SS format
  5017. <DT><B>\@</B>
  5018. <DD>
  5019. the current time in 12-hour am/pm format
  5020. <DT><B>\A</B>
  5021. <DD>
  5022. the current time in 24-hour HH:MM format
  5023. <DT><B>\u</B>
  5024. <DD>
  5025. the username of the current user
  5026. <DT><B>\v</B>
  5027. <DD>
  5028. the version of <B>bash</B> (e.g., 2.00)
  5029. <DT><B>\V</B>
  5030. <DD>
  5031. the release of <B>bash</B>, version + patch level (e.g., 2.00.0)
  5032. <DT><B>\w</B>
  5033. <DD>
  5034. the current working directory, with
  5035. <FONT SIZE=-1><B>$HOME</B>
  5036. </FONT>
  5037. abbreviated with a tilde
  5038. (uses the value of the
  5039. <FONT SIZE=-1><B>PROMPT_DIRTRIM</B>
  5040. </FONT>
  5041. variable)
  5042. <DT><B>\W</B>
  5043. <DD>
  5044. the basename of the current working directory, with
  5045. <FONT SIZE=-1><B>$HOME</B>
  5046. </FONT>
  5047. abbreviated with a tilde
  5048. <DT><B>\!</B>
  5049. <DD>
  5050. the history number of this command
  5051. <DT><B>\#</B>
  5052. <DD>
  5053. the command number of this command
  5054. <DT><B>\$</B>
  5055. <DD>
  5056. if the effective UID is 0, a
  5057. <B>#</B>,
  5058. otherwise a
  5059. <B>$</B>
  5060. <DT><B>\</B><I>nnn</I>
  5061. <DD>
  5062. the character corresponding to the octal number <I>nnn</I>
  5063. <DT><B>\\</B>
  5064. <DD>
  5065. a backslash
  5066. <DT><B>\[</B>
  5067. <DD>
  5068. begin a sequence of non-printing characters, which could be used to
  5069. embed a terminal control sequence into the prompt
  5070. <DT><B>\]</B>
  5071. <DD>
  5072. end a sequence of non-printing characters
  5073. </DL></DL>
  5074. <P>
  5075. The command number and the history number are usually different:
  5076. the history number of a command is its position in the history
  5077. list, which may include commands restored from the history file
  5078. (see
  5079. <FONT SIZE=-1><B>HISTORY</B>
  5080. </FONT>
  5081. below), while the command number is the position in the sequence
  5082. of commands executed during the current shell session.
  5083. After the string is decoded, it is expanded via
  5084. parameter expansion, command substitution, arithmetic
  5085. expansion, and quote removal, subject to the value of the
  5086. <B>promptvars</B>
  5087. shell option (see the description of the
  5088. <B>shopt</B>
  5089. command under
  5090. <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
  5091. </FONT>
  5092. below).
  5093. <A NAME="lbCF">&nbsp;</A>
  5094. <H3>READLINE</H3>
  5095. This is the library that handles reading input when using an interactive
  5096. shell, unless the
  5097. <B>--noediting</B>
  5098. option is given at shell invocation.
  5099. Line editing is also used when using the <B>-e</B> option to the
  5100. <B>read</B> builtin.
  5101. By default, the line editing commands are similar to those of Emacs.
  5102. A vi-style line editing interface is also available.
  5103. Line editing can be enabled at any time using the
  5104. <B>-o emacs</B>
  5105. or
  5106. <B>-o vi</B>
  5107. options to the
  5108. <B>set</B>
  5109. builtin (see
  5110. <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
  5111. </FONT>
  5112. below).
  5113. To turn off line editing after the shell is running, use the
  5114. <B>+o emacs</B>
  5115. or
  5116. <B>+o vi</B>
  5117. options to the
  5118. <B>set</B>
  5119. builtin.
  5120. <A NAME="lbCG">&nbsp;</A>
  5121. <H4>Readline Notation</H4>
  5122. <P>
  5123. In this section, the Emacs-style notation is used to denote
  5124. keystrokes. Control keys are denoted by C-<I>key</I>, e.g., C-n
  5125. means Control-N. Similarly,
  5126. <I>meta</I>
  5127. keys are denoted by M-<I>key</I>, so M-x means Meta-X. (On keyboards
  5128. without a
  5129. <I>meta</I>
  5130. key, M-<I>x</I> means ESC <I>x</I>, i.e., press the Escape key
  5131. then the
  5132. <I>x</I>
  5133. key. This makes ESC the <I>meta prefix</I>.
  5134. The combination M-C-<I>x</I> means ESC-Control-<I>x</I>,
  5135. or press the Escape key
  5136. then hold the Control key while pressing the
  5137. <I>x</I>
  5138. key.)
  5139. <P>
  5140. Readline commands may be given numeric
  5141. <I>arguments</I>,
  5142. which normally act as a repeat count.
  5143. Sometimes, however, it is the sign of the argument that is significant.
  5144. Passing a negative argument to a command that acts in the forward
  5145. direction (e.g., <B>kill-line</B>) causes that command to act in a
  5146. backward direction.
  5147. Commands whose behavior with arguments deviates from this are noted
  5148. below.
  5149. <P>
  5150. When a command is described as <I>killing</I> text, the text
  5151. deleted is saved for possible future retrieval
  5152. (<I>yanking</I>). The killed text is saved in a
  5153. <I>kill ring</I>. Consecutive kills cause the text to be
  5154. accumulated into one unit, which can be yanked all at once.
  5155. Commands which do not kill text separate the chunks of text
  5156. on the kill ring.
  5157. <A NAME="lbCH">&nbsp;</A>
  5158. <H4>Readline Initialization</H4>
  5159. <P>
  5160. Readline is customized by putting commands in an initialization
  5161. file (the <I>inputrc</I> file).
  5162. The name of this file is taken from the value of the
  5163. <FONT SIZE=-1><B>INPUTRC</B>
  5164. </FONT>
  5165. variable. If that variable is unset, the default is
  5166. <A HREF="file:~/.inputrc"><I>~/.inputrc</I></A>.
  5167. When a program which uses the readline library starts up, the
  5168. initialization file is read, and the key bindings and variables
  5169. are set.
  5170. There are only a few basic constructs allowed in the
  5171. readline initialization file.
  5172. Blank lines are ignored.
  5173. Lines beginning with a <B>#</B> are comments.
  5174. Lines beginning with a <B>$</B> indicate conditional constructs.
  5175. Other lines denote key bindings and variable settings.
  5176. <P>
  5177. The default key-bindings may be changed with an
  5178. <I>inputrc</I>
  5179. file.
  5180. Other programs that use this library may add their own commands
  5181. and bindings.
  5182. <P>
  5183. For example, placing
  5184. <DL COMPACT><DT><DD>
  5185. <P>
  5186. M-Control-u: universal-argument
  5187. </DL>
  5188. or
  5189. <DL COMPACT><DT><DD>
  5190. C-Meta-u: universal-argument
  5191. </DL>
  5192. into the
  5193. <I>inputrc</I>
  5194. would make M-C-u execute the readline command
  5195. <I>universal-argument</I>.
  5196. <P>
  5197. The following symbolic character names are recognized:
  5198. <I>RUBOUT</I>,
  5199. <I>DEL</I>,
  5200. <I>ESC</I>,
  5201. <I>LFD</I>,
  5202. <I>NEWLINE</I>,
  5203. <I>RET</I>,
  5204. <I>RETURN</I>,
  5205. <I>SPC</I>,
  5206. <I>SPACE</I>,
  5207. and
  5208. <I>TAB</I>.
  5209. <P>
  5210. In addition to command names, readline allows keys to be bound
  5211. to a string that is inserted when the key is pressed (a <I>macro</I>).
  5212. <A NAME="lbCI">&nbsp;</A>
  5213. <H4>Readline Key Bindings</H4>
  5214. <P>
  5215. The syntax for controlling key bindings in the
  5216. <I>inputrc</I>
  5217. file is simple. All that is required is the name of the
  5218. command or the text of a macro and a key sequence to which
  5219. it should be bound. The name may be specified in one of two ways:
  5220. as a symbolic key name, possibly with <I>Meta-</I> or <I>Control-</I>
  5221. prefixes, or as a key sequence.
  5222. <P>
  5223. When using the form <B>keyname</B>:<I>function-name</I> or <I>macro</I>,
  5224. <I>keyname</I>
  5225. is the name of a key spelled out in English. For example:
  5226. <P>
  5227. <DL COMPACT><DT><DD>
  5228. Control-u: universal-argument
  5229. <BR>
  5230. Meta-Rubout: backward-kill-word
  5231. <BR>
  5232. Control-o: &quot;&gt; output&quot;
  5233. </DL>
  5234. <P>
  5235. In the above example,
  5236. <I>C-u</I>
  5237. is bound to the function
  5238. <B>universal-argument</B>,
  5239. <I>M-DEL</I>
  5240. is bound to the function
  5241. <B>backward-kill-word</B>,
  5242. and
  5243. <I>C-o</I>
  5244. is bound to run the macro
  5245. expressed on the right hand side (that is, to insert the text
  5246. <TT>&gt; output</TT>
  5247. into the line).
  5248. <P>
  5249. In the second form, <B>&quot;keyseq&quot;</B>:<I>function-name</I> or <I>macro</I>,
  5250. <B>keyseq</B>
  5251. differs from
  5252. <B>keyname</B>
  5253. above in that strings denoting
  5254. an entire key sequence may be specified by placing the sequence
  5255. within double quotes. Some GNU Emacs style key escapes can be
  5256. used, as in the following example, but the symbolic character names
  5257. are not recognized.
  5258. <P>
  5259. <DL COMPACT><DT><DD>
  5260. &quot;\C-u&quot;: universal-argument
  5261. <BR>
  5262. &quot;\C-x\C-r&quot;: re-read-init-file
  5263. <BR>
  5264. &quot;\e[11~&quot;: &quot;Function Key 1&quot;
  5265. </DL>
  5266. <P>
  5267. In this example,
  5268. <I>C-u</I>
  5269. is again bound to the function
  5270. <B>universal-argument</B>.
  5271. <I>C-x C-r</I>
  5272. is bound to the function
  5273. <B>re-read-init-file</B>,
  5274. and
  5275. <I>ESC [ 1 1 ~</I>
  5276. is bound to insert the text
  5277. <TT>Function Key 1</TT>.
  5278. <P>
  5279. The full set of GNU Emacs style escape sequences is
  5280. <DL COMPACT><DT><DD>
  5281. <DL COMPACT>
  5282. <DT><B>\C-</B>
  5283. <DD>
  5284. control prefix
  5285. <DT><B>\M-</B>
  5286. <DD>
  5287. meta prefix
  5288. <DT><B>\e</B>
  5289. <DD>
  5290. an escape character
  5291. <DT><B>\\</B>
  5292. <DD>
  5293. backslash
  5294. <DT><B>\</B>
  5295. <DD>
  5296. literal &quot;
  5297. <DT><B>\aq</B>
  5298. <DD>
  5299. literal aq
  5300. </DL></DL>
  5301. <P>
  5302. In addition to the GNU Emacs style escape sequences, a second
  5303. set of backslash escapes is available:
  5304. <DL COMPACT><DT><DD>
  5305. <DL COMPACT>
  5306. <DT><B>\a</B>
  5307. <DD>
  5308. alert (bell)
  5309. <DT><B>\b</B>
  5310. <DD>
  5311. backspace
  5312. <DT><B>\d</B>
  5313. <DD>
  5314. delete
  5315. <DT><B>\f</B>
  5316. <DD>
  5317. form feed
  5318. <DT><B>\n</B>
  5319. <DD>
  5320. newline
  5321. <DT><B>\r</B>
  5322. <DD>
  5323. carriage return
  5324. <DT><B>\t</B>
  5325. <DD>
  5326. horizontal tab
  5327. <DT><B>\v</B>
  5328. <DD>
  5329. vertical tab
  5330. <DT><B>\</B><I>nnn</I>
  5331. <DD>
  5332. the eight-bit character whose value is the octal value <I>nnn</I>
  5333. (one to three digits)
  5334. <DT><B>\x</B><I>HH</I>
  5335. <DD>
  5336. the eight-bit character whose value is the hexadecimal value <I>HH</I>
  5337. (one or two hex digits)
  5338. </DL></DL>
  5339. <P>
  5340. When entering the text of a macro, single or double quotes must
  5341. be used to indicate a macro definition.
  5342. Unquoted text is assumed to be a function name.
  5343. In the macro body, the backslash escapes described above are expanded.
  5344. Backslash will quote any other character in the macro text,
  5345. including &quot; and aq.
  5346. <P>
  5347. <B>Bash</B>
  5348. allows the current readline key bindings to be displayed or modified
  5349. with the
  5350. <B>bind</B>
  5351. builtin command. The editing mode may be switched during interactive
  5352. use by using the
  5353. <B>-o</B>
  5354. option to the
  5355. <B>set</B>
  5356. builtin command (see
  5357. <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
  5358. </FONT>
  5359. below).
  5360. <A NAME="lbCJ">&nbsp;</A>
  5361. <H4>Readline Variables</H4>
  5362. <P>
  5363. Readline has variables that can be used to further customize its
  5364. behavior. A variable may be set in the
  5365. <I>inputrc</I>
  5366. file with a statement of the form
  5367. <DL COMPACT><DT><DD>
  5368. <P>
  5369. <B>set</B> <I>variable-name</I> <I>value</I>
  5370. </DL>
  5371. <P>
  5372. Except where noted, readline variables can take the values
  5373. <B>On</B>
  5374. or
  5375. <B>Off</B>
  5376. (without regard to case).
  5377. Unrecognized variable names are ignored.
  5378. When a variable value is read, empty or null values, &quot;on&quot; (case-insensitive),
  5379. and &quot;1&quot; are equivalent to <B>On</B>. All other values are equivalent to
  5380. <B>Off</B>.
  5381. The variables and their default values are:
  5382. <P>
  5383. <DL COMPACT>
  5384. <DT><B>bell-style (audible)</B>
  5385. <DD>
  5386. Controls what happens when readline wants to ring the terminal bell.
  5387. If set to <B>none</B>, readline never rings the bell. If set to
  5388. <B>visible</B>, readline uses a visible bell if one is available.
  5389. If set to <B>audible</B>, readline attempts to ring the terminal's bell.
  5390. <DT><B>bind-tty-special-chars (On)</B>
  5391. <DD>
  5392. If set to <B>On</B>, readline attempts to bind the control characters
  5393. treated specially by the kernel's terminal driver to their readline
  5394. equivalents.
  5395. <DT><B>blink-matching-paren (Off)</B>
  5396. <DD>
  5397. If set to <B>On</B>, readline attempts to briefly move the cursor to an
  5398. opening parenthesis when a closing parenthesis is inserted.
  5399. <DT><B>colored-completion-prefix (Off)</B>
  5400. <DD>
  5401. If set to <B>On</B>, when listing completions, readline displays the
  5402. common prefix of the set of possible completions using a different color.
  5403. The color definitions are taken from the value of the <B>LS_COLORS</B>
  5404. environment variable.
  5405. <DT><B>colored-stats (Off)</B>
  5406. <DD>
  5407. If set to <B>On</B>, readline displays possible completions using different
  5408. colors to indicate their file type.
  5409. The color definitions are taken from the value of the <B>LS_COLORS</B>
  5410. environment variable.
  5411. <DT><B>comment-begin (``#'')</B>
  5412. <DD>
  5413. The string that is inserted when the readline
  5414. <B>insert-comment</B>
  5415. command is executed.
  5416. This command is bound to
  5417. <B>M-#</B>
  5418. in emacs mode and to
  5419. <B>#</B>
  5420. in vi command mode.
  5421. <DT><B>completion-display-width (-1)</B>
  5422. <DD>
  5423. The number of screen columns used to display possible matches
  5424. when performing completion.
  5425. The value is ignored if it is less than 0 or greater than the terminal
  5426. screen width.
  5427. A value of 0 will cause matches to be displayed one per line.
  5428. The default value is -1.
  5429. <DT><B>completion-ignore-case (Off)</B>
  5430. <DD>
  5431. If set to <B>On</B>, readline performs filename matching and completion
  5432. in a case-insensitive fashion.
  5433. <DT><B>completion-map-case (Off)</B>
  5434. <DD>
  5435. If set to <B>On</B>, and <B>completion-ignore-case</B> is enabled, readline
  5436. treats hyphens (<I>-</I>) and underscores (<I>_</I>) as equivalent when
  5437. performing case-insensitive filename matching and completion.
  5438. <DT><B>completion-prefix-display-length (0)</B>
  5439. <DD>
  5440. The length in characters of the common prefix of a list of possible
  5441. completions that is displayed without modification. When set to a
  5442. value greater than zero, common prefixes longer than this value are
  5443. replaced with an ellipsis when displaying possible completions.
  5444. <DT><B>completion-query-items (100)</B>
  5445. <DD>
  5446. This determines when the user is queried about viewing
  5447. the number of possible completions
  5448. generated by the <B>possible-completions</B> command.
  5449. It may be set to any integer value greater than or equal to
  5450. zero. If the number of possible completions is greater than
  5451. or equal to the value of this variable, the user is asked whether
  5452. or not he wishes to view them; otherwise they are simply listed
  5453. on the terminal.
  5454. <DT><B>convert-meta (On)</B>
  5455. <DD>
  5456. If set to <B>On</B>, readline will convert characters with the
  5457. eighth bit set to an ASCII key sequence
  5458. by stripping the eighth bit and prefixing an
  5459. escape character (in effect, using escape as the <I>meta prefix</I>).
  5460. The default is <I>On</I>, but readline will set it to <I>Off</I> if the
  5461. locale contains eight-bit characters.
  5462. <DT><B>disable-completion (Off)</B>
  5463. <DD>
  5464. If set to <B>On</B>, readline will inhibit word completion. Completion
  5465. characters will be inserted into the line as if they had been
  5466. mapped to <B>self-insert</B>.
  5467. <DT><B>echo-control-characters (On)</B>
  5468. <DD>
  5469. When set to <B>On</B>, on operating systems that indicate they support it,
  5470. readline echoes a character corresponding to a signal generated from the
  5471. keyboard.
  5472. <DT><B>editing-mode (emacs)</B>
  5473. <DD>
  5474. Controls whether readline begins with a set of key bindings similar
  5475. to <I>Emacs</I> or <I>vi</I>.
  5476. <B>editing-mode</B>
  5477. can be set to either
  5478. <B>emacs</B>
  5479. or
  5480. <B>vi</B>.
  5481. <DT><B>enable-bracketed-paste (Off)</B>
  5482. <DD>
  5483. When set to <B>On</B>, readline will configure the terminal in a way
  5484. that will enable it to insert each paste into the editing buffer as a
  5485. single string of characters, instead of treating each character as if
  5486. it had been read from the keyboard. This can prevent pasted characters
  5487. from being interpreted as editing commands.
  5488. <DT><B>enable-keypad (Off)</B>
  5489. <DD>
  5490. When set to <B>On</B>, readline will try to enable the application
  5491. keypad when it is called. Some systems need this to enable the
  5492. arrow keys.
  5493. <DT><B>enable-meta-key (On)</B>
  5494. <DD>
  5495. When set to <B>On</B>, readline will try to enable any meta modifier
  5496. key the terminal claims to support when it is called. On many terminals,
  5497. the meta key is used to send eight-bit characters.
  5498. <DT><B>expand-tilde (Off)</B>
  5499. <DD>
  5500. If set to <B>On</B>, tilde expansion is performed when readline
  5501. attempts word completion.
  5502. <DT><B>history-preserve-point (Off)</B>
  5503. <DD>
  5504. If set to <B>On</B>, the history code attempts to place point at the
  5505. same location on each history line retrieved with <B>previous-history</B>
  5506. or <B>next-history</B>.
  5507. <DT><B>history-size (unset)</B>
  5508. <DD>
  5509. Set the maximum number of history entries saved in the history list.
  5510. If set to zero, any existing history entries are deleted and no new entries
  5511. are saved.
  5512. If set to a value less than zero, the number of history entries is not
  5513. limited.
  5514. By default, the number of history entries is set to the value of the
  5515. <B>HISTSIZE</B> shell variable.
  5516. If an attempt is made to set <I>history-size</I> to a non-numeric value,
  5517. the maximum number of history entries will be set to 500.
  5518. <DT><B>horizontal-scroll-mode (Off)</B>
  5519. <DD>
  5520. When set to <B>On</B>, makes readline use a single line for display,
  5521. scrolling the input horizontally on a single screen line when it
  5522. becomes longer than the screen width rather than wrapping to a new line.
  5523. <DT><B>input-meta (Off)</B>
  5524. <DD>
  5525. If set to <B>On</B>, readline will enable eight-bit input (that is,
  5526. it will not strip the eighth bit from the characters it reads),
  5527. regardless of what the terminal claims it can support. The name
  5528. <B>meta-flag</B>
  5529. is a synonym for this variable.
  5530. The default is <I>Off</I>, but readline will set it to <I>On</I> if the
  5531. locale contains eight-bit characters.
  5532. <DT><B>isearch-terminators (``C-[C-J'')</B>
  5533. <DD>
  5534. The string of characters that should terminate an incremental
  5535. search without subsequently executing the character as a command.
  5536. If this variable has not been given a value, the characters
  5537. <I>ESC</I> and <I>C-J</I> will terminate an incremental search.
  5538. <DT><B>keymap (emacs)</B>
  5539. <DD>
  5540. Set the current readline keymap. The set of valid keymap names is
  5541. <I>emacs, emacs-standard, emacs-meta, emacs-ctlx, vi,
  5542. vi-command</I>, and
  5543. <I>vi-insert</I>.
  5544. <I>vi</I> is equivalent to <I>vi-command</I>; <I>emacs</I> is
  5545. equivalent to <I>emacs-standard</I>. The default value is
  5546. <I>emacs</I>;
  5547. the value of
  5548. <B>editing-mode</B>
  5549. also affects the default keymap.
  5550. <DT><B>emacs-mode-string (@)</B>
  5551. <DD>
  5552. This string is displayed immediately before the last line of the primary
  5553. prompt when emacs editing mode is active. The value is expanded like a
  5554. key binding, so the standard set of meta- and control prefixes and
  5555. backslash escape sequences is available.
  5556. Use the \1 and \2 escapes to begin and end sequences of
  5557. non-printing characters, which can be used to embed a terminal control
  5558. sequence into the mode string.
  5559. <DT><B>keyseq-timeout (500)</B>
  5560. <DD>
  5561. Specifies the duration <I>readline</I> will wait for a character when reading an
  5562. ambiguous key sequence (one that can form a complete key sequence using
  5563. the input read so far, or can take additional input to complete a longer
  5564. key sequence).
  5565. If no input is received within the timeout, <I>readline</I> will use the shorter
  5566. but complete key sequence.
  5567. The value is specified in milliseconds, so a value of 1000 means that
  5568. <I>readline</I> will wait one second for additional input.
  5569. If this variable is set to a value less than or equal to zero, or to a
  5570. non-numeric value, <I>readline</I> will wait until another key is pressed to
  5571. decide which key sequence to complete.
  5572. <DT><B>mark-directories (On)</B>
  5573. <DD>
  5574. If set to <B>On</B>, completed directory names have a slash
  5575. appended.
  5576. <DT><B>mark-modified-lines (Off)</B>
  5577. <DD>
  5578. If set to <B>On</B>, history lines that have been modified are displayed
  5579. with a preceding asterisk (<B>*</B>).
  5580. <DT><B>mark-symlinked-directories (Off)</B>
  5581. <DD>
  5582. If set to <B>On</B>, completed names which are symbolic links to directories
  5583. have a slash appended (subject to the value of
  5584. <B>mark-directories</B>).
  5585. <DT><B>match-hidden-files (On)</B>
  5586. <DD>
  5587. This variable, when set to <B>On</B>, causes readline to match files whose
  5588. names begin with a `.' (hidden files) when performing filename
  5589. completion.
  5590. If set to <B>Off</B>, the leading `.' must be
  5591. supplied by the user in the filename to be completed.
  5592. <DT><B>menu-complete-display-prefix (Off)</B>
  5593. <DD>
  5594. If set to <B>On</B>, menu completion displays the common prefix of the
  5595. list of possible completions (which may be empty) before cycling through
  5596. the list.
  5597. <DT><B>output-meta (Off)</B>
  5598. <DD>
  5599. If set to <B>On</B>, readline will display characters with the
  5600. eighth bit set directly rather than as a meta-prefixed escape
  5601. sequence.
  5602. The default is <I>Off</I>, but readline will set it to <I>On</I> if the
  5603. locale contains eight-bit characters.
  5604. <DT><B>page-completions (On)</B>
  5605. <DD>
  5606. If set to <B>On</B>, readline uses an internal <I>more</I>-like pager
  5607. to display a screenful of possible completions at a time.
  5608. <DT><B>print-completions-horizontally (Off)</B>
  5609. <DD>
  5610. If set to <B>On</B>, readline will display completions with matches
  5611. sorted horizontally in alphabetical order, rather than down the screen.
  5612. <DT><B>revert-all-at-newline (Off)</B>
  5613. <DD>
  5614. If set to <B>On</B>, readline will undo all changes to history lines
  5615. before returning when <B>accept-line</B> is executed. By default,
  5616. history lines may be modified and retain individual undo lists across
  5617. calls to <B>readline</B>.
  5618. <DT><B>show-all-if-ambiguous (Off)</B>
  5619. <DD>
  5620. This alters the default behavior of the completion functions. If
  5621. set to
  5622. <B>On</B>,
  5623. words which have more than one possible completion cause the
  5624. matches to be listed immediately instead of ringing the bell.
  5625. <DT><B>show-all-if-unmodified (Off)</B>
  5626. <DD>
  5627. This alters the default behavior of the completion functions in
  5628. a fashion similar to <B>show-all-if-ambiguous</B>.
  5629. If set to
  5630. <B>On</B>,
  5631. words which have more than one possible completion without any
  5632. possible partial completion (the possible completions don't share
  5633. a common prefix) cause the matches to be listed immediately instead
  5634. of ringing the bell.
  5635. <DT><B>show-mode-in-prompt (Off)</B>
  5636. <DD>
  5637. If set to <B>On</B>, add a character to the beginning of the prompt
  5638. indicating the editing mode: emacs (@), vi command (:) or vi
  5639. insertion (+).
  5640. <DT><B>skip-completed-text (Off)</B>
  5641. <DD>
  5642. If set to <B>On</B>, this alters the default completion behavior when
  5643. inserting a single match into the line. It's only active when
  5644. performing completion in the middle of a word. If enabled, readline
  5645. does not insert characters from the completion that match characters
  5646. after point in the word being completed, so portions of the word
  5647. following the cursor are not duplicated.
  5648. <DT><B>vi-cmd-mode-string ((cmd))</B>
  5649. <DD>
  5650. This string is displayed immediately before the last line of the primary
  5651. prompt when vi editing mode is active and in command mode.
  5652. The value is expanded like a
  5653. key binding, so the standard set of meta- and control prefixes and
  5654. backslash escape sequences is available.
  5655. Use the \1 and \2 escapes to begin and end sequences of
  5656. non-printing characters, which can be used to embed a terminal control
  5657. sequence into the mode string.
  5658. <DT><B>vi-ins-mode-string ((ins))</B>
  5659. <DD>
  5660. This string is displayed immediately before the last line of the primary
  5661. prompt when vi editing mode is active and in insertion mode.
  5662. The value is expanded like a
  5663. key binding, so the standard set of meta- and control prefixes and
  5664. backslash escape sequences is available.
  5665. Use the \1 and \2 escapes to begin and end sequences of
  5666. non-printing characters, which can be used to embed a terminal control
  5667. sequence into the mode string.
  5668. <DT><B>visible-stats (Off)</B>
  5669. <DD>
  5670. If set to <B>On</B>, a character denoting a file's type as reported
  5671. by <I>stat</I>(2) is appended to the filename when listing possible
  5672. completions.
  5673. </DL>
  5674. <A NAME="lbCK">&nbsp;</A>
  5675. <H4>Readline Conditional Constructs</H4>
  5676. <P>
  5677. Readline implements a facility similar in spirit to the conditional
  5678. compilation features of the C preprocessor which allows key
  5679. bindings and variable settings to be performed as the result
  5680. of tests. There are four parser directives used.
  5681. <DL COMPACT>
  5682. <DT><B>$if</B><DD>
  5683. The
  5684. <B>$if</B>
  5685. construct allows bindings to be made based on the
  5686. editing mode, the terminal being used, or the application using
  5687. readline. The text of the test extends to the end of the line;
  5688. no characters are required to isolate it.
  5689. <DL COMPACT><DT><DD>
  5690. <DL COMPACT>
  5691. <DT><B>mode</B><DD>
  5692. The <B>mode=</B> form of the <B>$if</B> directive is used to test
  5693. whether readline is in emacs or vi mode.
  5694. This may be used in conjunction
  5695. with the <B>set keymap</B> command, for instance, to set bindings in
  5696. the <I>emacs-standard</I> and <I>emacs-ctlx</I> keymaps only if
  5697. readline is starting out in emacs mode.
  5698. <DT><B>term</B><DD>
  5699. The <B>term=</B> form may be used to include terminal-specific
  5700. key bindings, perhaps to bind the key sequences output by the
  5701. terminal's function keys. The word on the right side of the
  5702. <B>=</B>
  5703. is tested against both the full name of the terminal and the portion
  5704. of the terminal name before the first <B>-</B>. This allows
  5705. <I>sun</I>
  5706. to match both
  5707. <I>sun</I>
  5708. and
  5709. <I>sun-cmd</I>,
  5710. for instance.
  5711. <DT><B>application</B><DD>
  5712. The <B>application</B> construct is used to include
  5713. application-specific settings. Each program using the readline
  5714. library sets the <I>application name</I>, and an initialization
  5715. file can test for a particular value.
  5716. This could be used to bind key sequences to functions useful for
  5717. a specific program. For instance, the following command adds a
  5718. key sequence that quotes the current or previous word in <B>bash</B>:
  5719. <P>
  5720. <DL COMPACT><DT><DD>
  5721. <PRE>
  5722. <B>$if</B> Bash
  5723. # Quote the current or previous word
  5724. &quot;\C-xq&quot;: &quot;\eb\&quot;\ef\&quot;&quot;
  5725. <B>$endif</B>
  5726. </PRE>
  5727. </DL>
  5728. </DL></DL>
  5729. <DT><B>$endif</B><DD>
  5730. This command, as seen in the previous example, terminates an
  5731. <B>$if</B> command.
  5732. <DT><B>$else</B><DD>
  5733. Commands in this branch of the <B>$if</B> directive are executed if
  5734. the test fails.
  5735. <DT><B>$include</B><DD>
  5736. This directive takes a single filename as an argument and reads commands
  5737. and bindings from that file. For example, the following directive
  5738. would read <A HREF="file:/etc/inputrc"><I>/etc/inputrc</I></A>:
  5739. <P>
  5740. <DL COMPACT><DT><DD>
  5741. <PRE>
  5742. <B>$include</B> <A HREF="file:/etc/inputrc"><I>/etc/inputrc</I></A>
  5743. </PRE>
  5744. </DL>
  5745. </DL>
  5746. <A NAME="lbCL">&nbsp;</A>
  5747. <H4>Searching</H4>
  5748. <P>
  5749. Readline provides commands for searching through the command history
  5750. (see
  5751. <FONT SIZE=-1><B>HISTORY</B>
  5752. </FONT>
  5753. below) for lines containing a specified string.
  5754. There are two search modes:
  5755. <I>incremental</I>
  5756. and
  5757. <I>non-incremental</I>.
  5758. <P>
  5759. Incremental searches begin before the user has finished typing the
  5760. search string.
  5761. As each character of the search string is typed, readline displays
  5762. the next entry from the history matching the string typed so far.
  5763. An incremental search requires only as many characters as needed to
  5764. find the desired history entry.
  5765. The characters present in the value of the <B>isearch-terminators</B>
  5766. variable are used to terminate an incremental search.
  5767. If that variable has not been assigned a value the Escape and
  5768. Control-J characters will terminate an incremental search.
  5769. Control-G will abort an incremental search and restore the original
  5770. line.
  5771. When the search is terminated, the history entry containing the
  5772. search string becomes the current line.
  5773. <P>
  5774. To find other matching entries in the history list, type Control-S or
  5775. Control-R as appropriate.
  5776. This will search backward or forward in the history for the next
  5777. entry matching the search string typed so far.
  5778. Any other key sequence bound to a readline command will terminate
  5779. the search and execute that command.
  5780. For instance, a <I>newline</I> will terminate the search and accept
  5781. the line, thereby executing the command from the history list.
  5782. <P>
  5783. Readline remembers the last incremental search string. If two
  5784. Control-Rs are typed without any intervening characters defining a
  5785. new search string, any remembered search string is used.
  5786. <P>
  5787. Non-incremental searches read the entire search string before starting
  5788. to search for matching history lines. The search string may be
  5789. typed by the user or be part of the contents of the current line.
  5790. <A NAME="lbCM">&nbsp;</A>
  5791. <H4>Readline Command Names</H4>
  5792. <P>
  5793. The following is a list of the names of the commands and the default
  5794. key sequences to which they are bound.
  5795. Command names without an accompanying key sequence are unbound by default.
  5796. In the following descriptions, <I>point</I> refers to the current cursor
  5797. position, and <I>mark</I> refers to a cursor position saved by the
  5798. <B>set-mark</B> command.
  5799. The text between the point and mark is referred to as the <I>region</I>.
  5800. <A NAME="lbCN">&nbsp;</A>
  5801. <H4>Commands for Moving</H4>
  5802. <P>
  5803. <DL COMPACT>
  5804. <DT><B>beginning-of-line (C-a)</B>
  5805. <DD>
  5806. Move to the start of the current line.
  5807. <DT><B>end-of-line (C-e)</B>
  5808. <DD>
  5809. Move to the end of the line.
  5810. <DT><B>forward-char (C-f)</B>
  5811. <DD>
  5812. Move forward a character.
  5813. <DT><B>backward-char (C-b)</B>
  5814. <DD>
  5815. Move back a character.
  5816. <DT><B>forward-word (M-f)</B>
  5817. <DD>
  5818. Move forward to the end of the next word. Words are composed of
  5819. alphanumeric characters (letters and digits).
  5820. <DT><B>backward-word (M-b)</B>
  5821. <DD>
  5822. Move back to the start of the current or previous word.
  5823. Words are composed of alphanumeric characters (letters and digits).
  5824. <DT><B>shell-forward-word</B>
  5825. <DD>
  5826. Move forward to the end of the next word.
  5827. Words are delimited by non-quoted shell metacharacters.
  5828. <DT><B>shell-backward-word</B>
  5829. <DD>
  5830. Move back to the start of the current or previous word.
  5831. Words are delimited by non-quoted shell metacharacters.
  5832. <DT><B>clear-screen (C-l)</B>
  5833. <DD>
  5834. Clear the screen leaving the current line at the top of the screen.
  5835. With an argument, refresh the current line without clearing the
  5836. screen.
  5837. <DT><B>redraw-current-line</B>
  5838. <DD>
  5839. Refresh the current line.
  5840. </DL>
  5841. <A NAME="lbCO">&nbsp;</A>
  5842. <H4>Commands for Manipulating the History</H4>
  5843. <P>
  5844. <DL COMPACT>
  5845. <DT><B>accept-line (Newline, Return)</B>
  5846. <DD>
  5847. Accept the line regardless of where the cursor is. If this line is
  5848. non-empty, add it to the history list according to the state of the
  5849. <FONT SIZE=-1><B>HISTCONTROL</B>
  5850. </FONT>
  5851. variable. If the line is a modified history
  5852. line, then restore the history line to its original state.
  5853. <DT><B>previous-history (C-p)</B>
  5854. <DD>
  5855. Fetch the previous command from the history list, moving back in
  5856. the list.
  5857. <DT><B>next-history (C-n)</B>
  5858. <DD>
  5859. Fetch the next command from the history list, moving forward in the
  5860. list.
  5861. <DT><B>beginning-of-history (M-&lt;)</B>
  5862. <DD>
  5863. Move to the first line in the history.
  5864. <DT><B>end-of-history (M-&gt;)</B>
  5865. <DD>
  5866. Move to the end of the input history, i.e., the line currently being
  5867. entered.
  5868. <DT><B>reverse-search-history (C-r)</B>
  5869. <DD>
  5870. Search backward starting at the current line and moving `up' through
  5871. the history as necessary. This is an incremental search.
  5872. <DT><B>forward-search-history (C-s)</B>
  5873. <DD>
  5874. Search forward starting at the current line and moving `down' through
  5875. the history as necessary. This is an incremental search.
  5876. <DT><B>non-incremental-reverse-search-history (M-p)</B>
  5877. <DD>
  5878. Search backward through the history starting at the current line
  5879. using a non-incremental search for a string supplied by the user.
  5880. <DT><B>non-incremental-forward-search-history (M-n)</B>
  5881. <DD>
  5882. Search forward through the history using a non-incremental search for
  5883. a string supplied by the user.
  5884. <DT><B>history-search-forward</B>
  5885. <DD>
  5886. Search forward through the history for the string of characters
  5887. between the start of the current line and the point.
  5888. This is a non-incremental search.
  5889. <DT><B>history-search-backward</B>
  5890. <DD>
  5891. Search backward through the history for the string of characters
  5892. between the start of the current line and the point.
  5893. This is a non-incremental search.
  5894. <DT><B>yank-nth-arg (M-C-y)</B>
  5895. <DD>
  5896. Insert the first argument to the previous command (usually
  5897. the second word on the previous line) at point.
  5898. With an argument
  5899. <I>n</I>,
  5900. insert the <I>n</I>th word from the previous command (the words
  5901. in the previous command begin with word 0). A negative argument
  5902. inserts the <I>n</I>th word from the end of the previous command.
  5903. Once the argument <I>n</I> is computed, the argument is extracted
  5904. as if the &quot;!<I>n</I>&quot; history expansion had been specified.
  5905. <DT><B>yank-last-arg (M-., M-_)</B>
  5906. <DD>
  5907. Insert the last argument to the previous command (the last word of
  5908. the previous history entry).
  5909. With a numeric argument, behave exactly like <B>yank-nth-arg</B>.
  5910. Successive calls to <B>yank-last-arg</B> move back through the history
  5911. list, inserting the last word (or the word specified by the argument to
  5912. the first call) of each line in turn.
  5913. Any numeric argument supplied to these successive calls determines
  5914. the direction to move through the history. A negative argument switches
  5915. the direction through the history (back or forward).
  5916. The history expansion facilities are used to extract the last word,
  5917. as if the &quot;!$&quot; history expansion had been specified.
  5918. <DT><B>shell-expand-line (M-C-e)</B>
  5919. <DD>
  5920. Expand the line as the shell does. This
  5921. performs alias and history expansion as well as all of the shell
  5922. word expansions. See
  5923. <FONT SIZE=-1><B>HISTORY EXPANSION</B>
  5924. </FONT>
  5925. below for a description of history expansion.
  5926. <DT><B>history-expand-line (M-^)</B>
  5927. <DD>
  5928. Perform history expansion on the current line.
  5929. See
  5930. <FONT SIZE=-1><B>HISTORY EXPANSION</B>
  5931. </FONT>
  5932. below for a description of history expansion.
  5933. <DT><B>magic-space</B>
  5934. <DD>
  5935. Perform history expansion on the current line and insert a space.
  5936. See
  5937. <FONT SIZE=-1><B>HISTORY EXPANSION</B>
  5938. </FONT>
  5939. below for a description of history expansion.
  5940. <DT><B>alias-expand-line</B>
  5941. <DD>
  5942. Perform alias expansion on the current line.
  5943. See
  5944. <FONT SIZE=-1><B>ALIASES</B>
  5945. </FONT>
  5946. above for a description of alias expansion.
  5947. <DT><B>history-and-alias-expand-line</B>
  5948. <DD>
  5949. Perform history and alias expansion on the current line.
  5950. <DT><B>insert-last-argument (M-., M-_)</B>
  5951. <DD>
  5952. A synonym for <B>yank-last-arg</B>.
  5953. <DT><B>operate-and-get-next (C-o)</B>
  5954. <DD>
  5955. Accept the current line for execution and fetch the next line
  5956. relative to the current line from the history for editing. Any
  5957. argument is ignored.
  5958. <DT><B>edit-and-execute-command (C-xC-e)</B>
  5959. <DD>
  5960. Invoke an editor on the current command line, and execute the result as shell
  5961. commands.
  5962. <B>Bash</B> attempts to invoke
  5963. <FONT SIZE=-1><B>$VISUAL</B>,
  5964. </FONT>
  5965. <FONT SIZE=-1><B>$EDITOR</B>,
  5966. </FONT>
  5967. and <I>emacs</I> as the editor, in that order.
  5968. </DL>
  5969. <A NAME="lbCP">&nbsp;</A>
  5970. <H4>Commands for Changing Text</H4>
  5971. <P>
  5972. <DL COMPACT>
  5973. <DT><B></B><I>end-of-file</I> (usually C-d)
  5974. <DD>
  5975. The character indicating end-of-file as set, for example, by
  5976. <TT>stty</TT>.
  5977. If this character is read when there are no characters
  5978. on the line, and point is at the beginning of the line, Readline
  5979. interprets it as the end of input and returns
  5980. <FONT SIZE=-1><B>EOF</B>.
  5981. </FONT>
  5982. <DT><B>delete-char (C-d)</B>
  5983. <DD>
  5984. Delete the character at point.
  5985. If this function is bound to the
  5986. same character as the tty <B>EOF</B> character, as <B>C-d</B>
  5987. commonly is, see above for the effects.
  5988. <DT><B>backward-delete-char (Rubout)</B>
  5989. <DD>
  5990. Delete the character behind the cursor. When given a numeric argument,
  5991. save the deleted text on the kill ring.
  5992. <DT><B>forward-backward-delete-char</B>
  5993. <DD>
  5994. Delete the character under the cursor, unless the cursor is at the
  5995. end of the line, in which case the character behind the cursor is
  5996. deleted.
  5997. <DT><B>quoted-insert (C-q, C-v)</B>
  5998. <DD>
  5999. Add the next character typed to the line verbatim. This is
  6000. how to insert characters like <B>C-q</B>, for example.
  6001. <DT><B>tab-insert (C-v TAB)</B>
  6002. <DD>
  6003. Insert a tab character.
  6004. <DT><B>self-insert (a,&nbsp;b,&nbsp;A,&nbsp;1,&nbsp;!,&nbsp;...)</B>
  6005. <DD>
  6006. Insert the character typed.
  6007. <DT><B>transpose-chars (C-t)</B>
  6008. <DD>
  6009. Drag the character before point forward over the character at point,
  6010. moving point forward as well.
  6011. If point is at the end of the line, then this transposes
  6012. the two characters before point.
  6013. Negative arguments have no effect.
  6014. <DT><B>transpose-words (M-t)</B>
  6015. <DD>
  6016. Drag the word before point past the word after point,
  6017. moving point over that word as well.
  6018. If point is at the end of the line, this transposes
  6019. the last two words on the line.
  6020. <DT><B>upcase-word (M-u)</B>
  6021. <DD>
  6022. Uppercase the current (or following) word. With a negative argument,
  6023. uppercase the previous word, but do not move point.
  6024. <DT><B>downcase-word (M-l)</B>
  6025. <DD>
  6026. Lowercase the current (or following) word. With a negative argument,
  6027. lowercase the previous word, but do not move point.
  6028. <DT><B>capitalize-word (M-c)</B>
  6029. <DD>
  6030. Capitalize the current (or following) word. With a negative argument,
  6031. capitalize the previous word, but do not move point.
  6032. <DT><B>overwrite-mode</B>
  6033. <DD>
  6034. Toggle overwrite mode. With an explicit positive numeric argument,
  6035. switches to overwrite mode. With an explicit non-positive numeric
  6036. argument, switches to insert mode. This command affects only
  6037. <B>emacs</B> mode; <B>vi</B> mode does overwrite differently.
  6038. Each call to <I>readline()</I> starts in insert mode.
  6039. In overwrite mode, characters bound to <B>self-insert</B> replace
  6040. the text at point rather than pushing the text to the right.
  6041. Characters bound to <B>backward-delete-char</B> replace the character
  6042. before point with a space. By default, this command is unbound.
  6043. </DL>
  6044. <A NAME="lbCQ">&nbsp;</A>
  6045. <H4>Killing and Yanking</H4>
  6046. <P>
  6047. <DL COMPACT>
  6048. <DT><B>kill-line (C-k)</B>
  6049. <DD>
  6050. Kill the text from point to the end of the line.
  6051. <DT><B>backward-kill-line (C-x Rubout)</B>
  6052. <DD>
  6053. Kill backward to the beginning of the line.
  6054. <DT><B>unix-line-discard (C-u)</B>
  6055. <DD>
  6056. Kill backward from point to the beginning of the line.
  6057. The killed text is saved on the kill-ring.
  6058. <DT><B>kill-whole-line</B>
  6059. <DD>
  6060. Kill all characters on the current line, no matter where point is.
  6061. <DT><B>kill-word (M-d)</B>
  6062. <DD>
  6063. Kill from point to the end of the current word, or if between
  6064. words, to the end of the next word.
  6065. Word boundaries are the same as those used by <B>forward-word</B>.
  6066. <DT><B>backward-kill-word (M-Rubout)</B>
  6067. <DD>
  6068. Kill the word behind point.
  6069. Word boundaries are the same as those used by <B>backward-word</B>.
  6070. <DT><B>shell-kill-word</B>
  6071. <DD>
  6072. Kill from point to the end of the current word, or if between
  6073. words, to the end of the next word.
  6074. Word boundaries are the same as those used by <B>shell-forward-word</B>.
  6075. <DT><B>shell-backward-kill-word</B>
  6076. <DD>
  6077. Kill the word behind point.
  6078. Word boundaries are the same as those used by <B>shell-backward-word</B>.
  6079. <DT><B>unix-word-rubout (C-w)</B>
  6080. <DD>
  6081. Kill the word behind point, using white space as a word boundary.
  6082. The killed text is saved on the kill-ring.
  6083. <DT><B>unix-filename-rubout</B>
  6084. <DD>
  6085. Kill the word behind point, using white space and the slash character
  6086. as the word boundaries.
  6087. The killed text is saved on the kill-ring.
  6088. <DT><B>delete-horizontal-space (M-\)</B>
  6089. <DD>
  6090. Delete all spaces and tabs around point.
  6091. <DT><B>kill-region</B>
  6092. <DD>
  6093. Kill the text in the current region.
  6094. <DT><B>copy-region-as-kill</B>
  6095. <DD>
  6096. Copy the text in the region to the kill buffer.
  6097. <DT><B>copy-backward-word</B>
  6098. <DD>
  6099. Copy the word before point to the kill buffer.
  6100. The word boundaries are the same as <B>backward-word</B>.
  6101. <DT><B>copy-forward-word</B>
  6102. <DD>
  6103. Copy the word following point to the kill buffer.
  6104. The word boundaries are the same as <B>forward-word</B>.
  6105. <DT><B>yank (C-y)</B>
  6106. <DD>
  6107. Yank the top of the kill ring into the buffer at point.
  6108. <DT><B>yank-pop (M-y)</B>
  6109. <DD>
  6110. Rotate the kill ring, and yank the new top. Only works following
  6111. <B>yank</B>
  6112. or
  6113. <B>yank-pop</B>.
  6114. </DL>
  6115. <A NAME="lbCR">&nbsp;</A>
  6116. <H4>Numeric Arguments</H4>
  6117. <P>
  6118. <DL COMPACT>
  6119. <DT><B>digit-argument (M-0, M-1, ..., M--)</B>
  6120. <DD>
  6121. Add this digit to the argument already accumulating, or start a new
  6122. argument. M-- starts a negative argument.
  6123. <DT><B>universal-argument</B>
  6124. <DD>
  6125. This is another way to specify an argument.
  6126. If this command is followed by one or more digits, optionally with a
  6127. leading minus sign, those digits define the argument.
  6128. If the command is followed by digits, executing
  6129. <B>universal-argument</B>
  6130. again ends the numeric argument, but is otherwise ignored.
  6131. As a special case, if this command is immediately followed by a
  6132. character that is neither a digit nor minus sign, the argument count
  6133. for the next command is multiplied by four.
  6134. The argument count is initially one, so executing this function the
  6135. first time makes the argument count four, a second time makes the
  6136. argument count sixteen, and so on.
  6137. </DL>
  6138. <A NAME="lbCS">&nbsp;</A>
  6139. <H4>Completing</H4>
  6140. <P>
  6141. <DL COMPACT>
  6142. <DT><B>complete (TAB)</B>
  6143. <DD>
  6144. Attempt to perform completion on the text before point.
  6145. <B>Bash</B>
  6146. attempts completion treating the text as a variable (if the
  6147. text begins with <B>$</B>), username (if the text begins with
  6148. <B>~</B>), hostname (if the text begins with <B>@</B>), or
  6149. command (including aliases and functions) in turn. If none
  6150. of these produces a match, filename completion is attempted.
  6151. <DT><B>possible-completions (M-?)</B>
  6152. <DD>
  6153. List the possible completions of the text before point.
  6154. <DT><B>insert-completions (M-*)</B>
  6155. <DD>
  6156. Insert all completions of the text before point
  6157. that would have been generated by
  6158. <B>possible-completions</B>.
  6159. <DT><B>menu-complete</B>
  6160. <DD>
  6161. Similar to <B>complete</B>, but replaces the word to be completed
  6162. with a single match from the list of possible completions.
  6163. Repeated execution of <B>menu-complete</B> steps through the list
  6164. of possible completions, inserting each match in turn.
  6165. At the end of the list of completions, the bell is rung
  6166. (subject to the setting of <B>bell-style</B>)
  6167. and the original text is restored.
  6168. An argument of <I>n</I> moves <I>n</I> positions forward in the list
  6169. of matches; a negative argument may be used to move backward
  6170. through the list.
  6171. This command is intended to be bound to <B>TAB</B>, but is unbound
  6172. by default.
  6173. <DT><B>menu-complete-backward</B>
  6174. <DD>
  6175. Identical to <B>menu-complete</B>, but moves backward through the list
  6176. of possible completions, as if <B>menu-complete</B> had been given a
  6177. negative argument. This command is unbound by default.
  6178. <DT><B>delete-char-or-list</B>
  6179. <DD>
  6180. Deletes the character under the cursor if not at the beginning or
  6181. end of the line (like <B>delete-char</B>).
  6182. If at the end of the line, behaves identically to
  6183. <B>possible-completions</B>.
  6184. This command is unbound by default.
  6185. <DT><B>complete-filename (M-/)</B>
  6186. <DD>
  6187. Attempt filename completion on the text before point.
  6188. <DT><B>possible-filename-completions (C-x /)</B>
  6189. <DD>
  6190. List the possible completions of the text before point,
  6191. treating it as a filename.
  6192. <DT><B>complete-username (M-~)</B>
  6193. <DD>
  6194. Attempt completion on the text before point, treating
  6195. it as a username.
  6196. <DT><B>possible-username-completions (C-x ~)</B>
  6197. <DD>
  6198. List the possible completions of the text before point,
  6199. treating it as a username.
  6200. <DT><B>complete-variable (M-$)</B>
  6201. <DD>
  6202. Attempt completion on the text before point, treating
  6203. it as a shell variable.
  6204. <DT><B>possible-variable-completions (C-x $)</B>
  6205. <DD>
  6206. List the possible completions of the text before point,
  6207. treating it as a shell variable.
  6208. <DT><B>complete-hostname (M-@)</B>
  6209. <DD>
  6210. Attempt completion on the text before point, treating
  6211. it as a hostname.
  6212. <DT><B>possible-hostname-completions (C-x @)</B>
  6213. <DD>
  6214. List the possible completions of the text before point,
  6215. treating it as a hostname.
  6216. <DT><B>complete-command (M-!)</B>
  6217. <DD>
  6218. Attempt completion on the text before point, treating
  6219. it as a command name. Command completion attempts to
  6220. match the text against aliases, reserved words, shell
  6221. functions, shell builtins, and finally executable filenames,
  6222. in that order.
  6223. <DT><B>possible-command-completions (C-x !)</B>
  6224. <DD>
  6225. List the possible completions of the text before point,
  6226. treating it as a command name.
  6227. <DT><B>dynamic-complete-history (M-TAB)</B>
  6228. <DD>
  6229. Attempt completion on the text before point, comparing
  6230. the text against lines from the history list for possible
  6231. completion matches.
  6232. <DT><B>dabbrev-expand</B>
  6233. <DD>
  6234. Attempt menu completion on the text before point, comparing
  6235. the text against lines from the history list for possible
  6236. completion matches.
  6237. <DT><B>complete-into-braces (M-{)</B>
  6238. <DD>
  6239. Perform filename completion and insert the list of possible completions
  6240. enclosed within braces so the list is available to the shell (see
  6241. <B>Brace Expansion</B>
  6242. above).
  6243. </DL>
  6244. <A NAME="lbCT">&nbsp;</A>
  6245. <H4>Keyboard Macros</H4>
  6246. <P>
  6247. <DL COMPACT>
  6248. <DT><B>start-kbd-macro (C-x ()</B>
  6249. <DD>
  6250. Begin saving the characters typed into the current keyboard macro.
  6251. <DT><B>end-kbd-macro (C-x ))</B>
  6252. <DD>
  6253. Stop saving the characters typed into the current keyboard macro
  6254. and store the definition.
  6255. <DT><B>call-last-kbd-macro (C-x e)</B>
  6256. <DD>
  6257. Re-execute the last keyboard macro defined, by making the characters
  6258. in the macro appear as if typed at the keyboard.
  6259. <DT><B>print-last-kbd-macro ()</B>
  6260. <DD>
  6261. Print the last keyboard macro defined in a format suitable for the
  6262. <I>inputrc</I> file.
  6263. </DL>
  6264. <A NAME="lbCU">&nbsp;</A>
  6265. <H4>Miscellaneous</H4>
  6266. <P>
  6267. <DL COMPACT>
  6268. <DT><B>re-read-init-file (C-x C-r)</B>
  6269. <DD>
  6270. Read in the contents of the <I>inputrc</I> file, and incorporate
  6271. any bindings or variable assignments found there.
  6272. <DT><B>abort (C-g)</B>
  6273. <DD>
  6274. Abort the current editing command and
  6275. ring the terminal's bell (subject to the setting of
  6276. <B>bell-style</B>).
  6277. <DT><B>do-uppercase-version (M-a, M-b, M-</B><I>x</I>, ...)
  6278. <DD>
  6279. If the metafied character <I>x</I> is lowercase, run the command
  6280. that is bound to the corresponding uppercase character.
  6281. <DT><B>prefix-meta (ESC)</B>
  6282. <DD>
  6283. Metafy the next character typed.
  6284. <FONT SIZE=-1><B>ESC</B>
  6285. </FONT>
  6286. <B>f</B>
  6287. is equivalent to
  6288. <B>Meta-f</B>.
  6289. <DT><B>undo (C-_, C-x C-u)</B>
  6290. <DD>
  6291. Incremental undo, separately remembered for each line.
  6292. <DT><B>revert-line (M-r)</B>
  6293. <DD>
  6294. Undo all changes made to this line. This is like executing the
  6295. <B>undo</B>
  6296. command enough times to return the line to its initial state.
  6297. <DT><B>tilde-expand (M-&amp;)</B>
  6298. <DD>
  6299. Perform tilde expansion on the current word.
  6300. <DT><B>set-mark (C-@, M-&lt;space&gt;)</B>
  6301. <DD>
  6302. Set the mark to the point. If a
  6303. numeric argument is supplied, the mark is set to that position.
  6304. <DT><B>exchange-point-and-mark (C-x C-x)</B>
  6305. <DD>
  6306. Swap the point with the mark. The current cursor position is set to
  6307. the saved position, and the old cursor position is saved as the mark.
  6308. <DT><B>character-search (C-])</B>
  6309. <DD>
  6310. A character is read and point is moved to the next occurrence of that
  6311. character. A negative count searches for previous occurrences.
  6312. <DT><B>character-search-backward (M-C-])</B>
  6313. <DD>
  6314. A character is read and point is moved to the previous occurrence of that
  6315. character. A negative count searches for subsequent occurrences.
  6316. <DT><B>skip-csi-sequence</B>
  6317. <DD>
  6318. Read enough characters to consume a multi-key sequence such as those
  6319. defined for keys like Home and End. Such sequences begin with a
  6320. Control Sequence Indicator (CSI), usually ESC-[. If this sequence is
  6321. bound to &quot;\[&quot;, keys producing such sequences will have no effect
  6322. unless explicitly bound to a readline command, instead of inserting
  6323. stray characters into the editing buffer. This is unbound by default,
  6324. but usually bound to ESC-[.
  6325. <DT><B>insert-comment (M-#)</B>
  6326. <DD>
  6327. Without a numeric argument, the value of the readline
  6328. <B>comment-begin</B>
  6329. variable is inserted at the beginning of the current line.
  6330. If a numeric argument is supplied, this command acts as a toggle: if
  6331. the characters at the beginning of the line do not match the value
  6332. of <B>comment-begin</B>, the value is inserted, otherwise
  6333. the characters in <B>comment-begin</B> are deleted from the beginning of
  6334. the line.
  6335. In either case, the line is accepted as if a newline had been typed.
  6336. The default value of
  6337. <B>comment-begin</B> causes this command to make the current line
  6338. a shell comment.
  6339. If a numeric argument causes the comment character to be removed, the line
  6340. will be executed by the shell.
  6341. <DT><B>glob-complete-word (M-g)</B>
  6342. <DD>
  6343. The word before point is treated as a pattern for pathname expansion,
  6344. with an asterisk implicitly appended. This pattern is used to
  6345. generate a list of matching filenames for possible completions.
  6346. <DT><B>glob-expand-word (C-x *)</B>
  6347. <DD>
  6348. The word before point is treated as a pattern for pathname expansion,
  6349. and the list of matching filenames is inserted, replacing the word.
  6350. If a numeric argument is supplied, an asterisk is appended before
  6351. pathname expansion.
  6352. <DT><B>glob-list-expansions (C-x g)</B>
  6353. <DD>
  6354. The list of expansions that would have been generated by
  6355. <B>glob-expand-word</B>
  6356. is displayed, and the line is redrawn.
  6357. If a numeric argument is supplied, an asterisk is appended before
  6358. pathname expansion.
  6359. <DT><B>dump-functions</B>
  6360. <DD>
  6361. Print all of the functions and their key bindings to the
  6362. readline output stream. If a numeric argument is supplied,
  6363. the output is formatted in such a way that it can be made part
  6364. of an <I>inputrc</I> file.
  6365. <DT><B>dump-variables</B>
  6366. <DD>
  6367. Print all of the settable readline variables and their values to the
  6368. readline output stream. If a numeric argument is supplied,
  6369. the output is formatted in such a way that it can be made part
  6370. of an <I>inputrc</I> file.
  6371. <DT><B>dump-macros</B>
  6372. <DD>
  6373. Print all of the readline key sequences bound to macros and the
  6374. strings they output. If a numeric argument is supplied,
  6375. the output is formatted in such a way that it can be made part
  6376. of an <I>inputrc</I> file.
  6377. <DT><B>display-shell-version (C-x C-v)</B>
  6378. <DD>
  6379. Display version information about the current instance of
  6380. <B>bash</B>.
  6381. </DL>
  6382. <A NAME="lbCV">&nbsp;</A>
  6383. <H4>Programmable Completion</H4>
  6384. <P>
  6385. When word completion is attempted for an argument to a command for
  6386. which a completion specification (a <I>compspec</I>) has been defined
  6387. using the <B>complete</B> builtin (see
  6388. <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
  6389. </FONT>
  6390. below), the programmable completion facilities are invoked.
  6391. <P>
  6392. First, the command name is identified.
  6393. If the command word is the empty string (completion attempted at the
  6394. beginning of an empty line), any compspec defined with
  6395. the <B>-E</B> option to <B>complete</B> is used.
  6396. If a compspec has been defined for that command, the
  6397. compspec is used to generate the list of possible completions for the word.
  6398. If the command word is a full pathname, a compspec for the full
  6399. pathname is searched for first.
  6400. If no compspec is found for the full pathname, an attempt is made to
  6401. find a compspec for the portion following the final slash.
  6402. If those searches do not result in a compspec, any compspec defined with
  6403. the <B>-D</B> option to <B>complete</B> is used as the default.
  6404. <P>
  6405. Once a compspec has been found, it is used to generate the list of
  6406. matching words.
  6407. If a compspec is not found, the default <B>bash</B> completion as
  6408. described above under <B>Completing</B> is performed.
  6409. <P>
  6410. First, the actions specified by the compspec are used.
  6411. Only matches which are prefixed by the word being completed are
  6412. returned.
  6413. When the
  6414. <B>-f</B>
  6415. or
  6416. <B>-d</B>
  6417. option is used for filename or directory name completion, the shell
  6418. variable
  6419. <FONT SIZE=-1><B>FIGNORE</B>
  6420. </FONT>
  6421. is used to filter the matches.
  6422. <P>
  6423. Any completions specified by a pathname expansion pattern to the
  6424. <B>-G</B> option are generated next.
  6425. The words generated by the pattern need not match the word
  6426. being completed.
  6427. The
  6428. <FONT SIZE=-1><B>GLOBIGNORE</B>
  6429. </FONT>
  6430. shell variable is not used to filter the matches, but the
  6431. <FONT SIZE=-1><B>FIGNORE</B>
  6432. </FONT>
  6433. variable is used.
  6434. <P>
  6435. Next, the string specified as the argument to the <B>-W</B> option
  6436. is considered.
  6437. The string is first split using the characters in the
  6438. <FONT SIZE=-1><B>IFS</B>
  6439. </FONT>
  6440. special variable as delimiters.
  6441. Shell quoting is honored.
  6442. Each word is then expanded using
  6443. brace expansion, tilde expansion, parameter and variable expansion,
  6444. command substitution, and arithmetic expansion,
  6445. as described above under
  6446. <FONT SIZE=-1><B>EXPANSION</B>.
  6447. </FONT>
  6448. The results are split using the rules described above under
  6449. <B>Word Splitting</B>.
  6450. The results of the expansion are prefix-matched against the word being
  6451. completed, and the matching words become the possible completions.
  6452. <P>
  6453. After these matches have been generated, any shell function or command
  6454. specified with the <B>-F</B> and <B>-C</B> options is invoked.
  6455. When the command or function is invoked, the
  6456. <FONT SIZE=-1><B>COMP_LINE</B>,
  6457. </FONT>
  6458. <FONT SIZE=-1><B>COMP_POINT</B>,
  6459. </FONT>
  6460. <FONT SIZE=-1><B>COMP_KEY</B>,
  6461. </FONT>
  6462. and
  6463. <FONT SIZE=-1><B>COMP_TYPE</B>
  6464. </FONT>
  6465. variables are assigned values as described above under
  6466. <B>Shell Variables</B>.
  6467. If a shell function is being invoked, the
  6468. <FONT SIZE=-1><B>COMP_WORDS</B>
  6469. </FONT>
  6470. and
  6471. <FONT SIZE=-1><B>COMP_CWORD</B>
  6472. </FONT>
  6473. variables are also set.
  6474. When the function or command is invoked,
  6475. the first argument (<B>$1</B>) is the name of the command whose arguments are
  6476. being completed,
  6477. the second argument (<B>$2</B>) is the word being completed,
  6478. and the third argument (<B>$3</B>) is the word preceding the word being
  6479. completed on the current command line.
  6480. No filtering of the generated completions against the word being completed
  6481. is performed; the function or command has complete freedom in generating
  6482. the matches.
  6483. <P>
  6484. Any function specified with <B>-F</B> is invoked first.
  6485. The function may use any of the shell facilities, including the
  6486. <B>compgen</B> builtin described below, to generate the matches.
  6487. It must put the possible completions in the
  6488. <FONT SIZE=-1><B>COMPREPLY</B>
  6489. </FONT>
  6490. array variable, one per array element.
  6491. <P>
  6492. Next, any command specified with the <B>-C</B> option is invoked
  6493. in an environment equivalent to command substitution.
  6494. It should print a list of completions, one per line, to the
  6495. standard output.
  6496. Backslash may be used to escape a newline, if necessary.
  6497. <P>
  6498. After all of the possible completions are generated, any filter
  6499. specified with the <B>-X</B> option is applied to the list.
  6500. The filter is a pattern as used for pathname expansion; a <B>&amp;</B>
  6501. in the pattern is replaced with the text of the word being completed.
  6502. A literal <B>&amp;</B> may be escaped with a backslash; the backslash
  6503. is removed before attempting a match.
  6504. Any completion that matches the pattern will be removed from the list.
  6505. A leading <B>!</B> negates the pattern; in this case any completion
  6506. not matching the pattern will be removed.
  6507. If the
  6508. <B>nocasematch</B>
  6509. shell option is enabled, the match is performed without regard to the case
  6510. of alphabetic characters.
  6511. <P>
  6512. Finally, any prefix and suffix specified with the <B>-P</B> and <B>-S</B>
  6513. options are added to each member of the completion list, and the result is
  6514. returned to the readline completion code as the list of possible
  6515. completions.
  6516. <P>
  6517. If the previously-applied actions do not generate any matches, and the
  6518. <B>-o dirnames</B> option was supplied to <B>complete</B> when the
  6519. compspec was defined, directory name completion is attempted.
  6520. <P>
  6521. If the <B>-o plusdirs</B> option was supplied to <B>complete</B> when the
  6522. compspec was defined, directory name completion is attempted and any
  6523. matches are added to the results of the other actions.
  6524. <P>
  6525. By default, if a compspec is found, whatever it generates is returned
  6526. to the completion code as the full set of possible completions.
  6527. The default <B>bash</B> completions are not attempted, and the readline
  6528. default of filename completion is disabled.
  6529. If the <B>-o bashdefault</B> option was supplied to <B>complete</B> when
  6530. the compspec was defined, the <B>bash</B> default completions are attempted
  6531. if the compspec generates no matches.
  6532. If the <B>-o default</B> option was supplied to <B>complete</B> when the
  6533. compspec was defined, readline's default completion will be performed
  6534. if the compspec (and, if attempted, the default <B>bash</B> completions)
  6535. generate no matches.
  6536. <P>
  6537. When a compspec indicates that directory name completion is desired,
  6538. the programmable completion functions force readline to append a slash
  6539. to completed names which are symbolic links to directories, subject to
  6540. the value of the <B>mark-directories</B> readline variable, regardless
  6541. of the setting of the <B>mark-symlinked-directories</B> readline variable.
  6542. <P>
  6543. There is some support for dynamically modifying completions. This is
  6544. most useful when used in combination with a default completion specified
  6545. with <B>complete -D</B>.
  6546. It's possible for shell functions executed as completion
  6547. handlers to indicate that completion should be retried by returning an
  6548. exit status of 124. If a shell function returns 124, and changes
  6549. the compspec associated with the command on which completion is being
  6550. attempted (supplied as the first argument when the function is executed),
  6551. programmable completion restarts from the beginning, with an
  6552. attempt to find a new compspec for that command. This allows a set of
  6553. completions to be built dynamically as completion is attempted, rather than
  6554. being loaded all at once.
  6555. <P>
  6556. For instance, assuming that there is a library of compspecs, each kept in a
  6557. file corresponding to the name of the command, the following default
  6558. completion function would load completions dynamically:
  6559. <P>
  6560. <TT>_completion_loader()
  6561. <BR>
  6562. {
  6563. <BR>
  6564. <TT>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</TT>. &quot;/etc/bash_completion.d/$1.sh&quot; &gt;/dev/null 2&gt;&amp;1 &amp;&amp; return 124<BR>
  6565. <BR>
  6566. }
  6567. <BR>
  6568. complete -D -F _completion_loader -o bashdefault -o default
  6569. <BR>
  6570. </TT>
  6571. <A NAME="lbCW">&nbsp;</A>
  6572. <H3>HISTORY</H3>
  6573. When the
  6574. <B>-o history</B>
  6575. option to the
  6576. <B>set</B>
  6577. builtin is enabled, the shell provides access to the
  6578. <I>command history</I>,
  6579. the list of commands previously typed.
  6580. The value of the
  6581. <FONT SIZE=-1><B>HISTSIZE</B>
  6582. </FONT>
  6583. variable is used as the
  6584. number of commands to save in a history list.
  6585. The text of the last
  6586. <FONT SIZE=-1><B>HISTSIZE</B>
  6587. </FONT>
  6588. commands (default 500) is saved. The shell
  6589. stores each command in the history list prior to parameter and
  6590. variable expansion (see
  6591. <FONT SIZE=-1><B>EXPANSION</B>
  6592. </FONT>
  6593. above) but after history expansion is performed, subject to the
  6594. values of the shell variables
  6595. <FONT SIZE=-1><B>HISTIGNORE</B>
  6596. </FONT>
  6597. and
  6598. <FONT SIZE=-1><B>HISTCONTROL</B>.
  6599. </FONT>
  6600. <P>
  6601. On startup, the history is initialized from the file named by
  6602. the variable
  6603. <FONT SIZE=-1><B>HISTFILE</B>
  6604. </FONT>
  6605. (default <A HREF="file:~/.bash_history"><I>~/.bash_history</I></A>).
  6606. The file named by the value of
  6607. <FONT SIZE=-1><B>HISTFILE</B>
  6608. </FONT>
  6609. is truncated, if necessary, to contain no more than
  6610. the number of lines specified by the value of
  6611. <FONT SIZE=-1><B>HISTFILESIZE</B>.
  6612. </FONT>
  6613. If <B>HISTFILESIZE</B> is unset, or set to null, a non-numeric value,
  6614. or a numeric value less than zero, the history file is not truncated.
  6615. When the history file is read,
  6616. lines beginning with the history comment character followed immediately
  6617. by a digit are interpreted as timestamps for the preceding history line.
  6618. These timestamps are optionally displayed depending on the value of the
  6619. <FONT SIZE=-1><B>HISTTIMEFORMAT</B>
  6620. </FONT>
  6621. variable.
  6622. When a shell with history enabled exits, the last
  6623. <FONT SIZE=-1><B>$HISTSIZE</B>
  6624. </FONT>
  6625. lines are copied from the history list to
  6626. <FONT SIZE=-1><B>$HISTFILE</B>.
  6627. </FONT>
  6628. If the
  6629. <B>histappend</B>
  6630. shell option is enabled
  6631. (see the description of
  6632. <B>shopt</B>
  6633. under
  6634. <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
  6635. </FONT>
  6636. below), the lines are appended to the history file,
  6637. otherwise the history file is overwritten.
  6638. If
  6639. <FONT SIZE=-1><B>HISTFILE</B>
  6640. </FONT>
  6641. is unset, or if the history file is unwritable, the history is
  6642. not saved.
  6643. If the
  6644. <FONT SIZE=-1><B>HISTTIMEFORMAT</B>
  6645. </FONT>
  6646. variable is set, time stamps are written to the history file, marked
  6647. with the history comment character, so
  6648. they may be preserved across shell sessions.
  6649. This uses the history comment character to distinguish timestamps from
  6650. other history lines.
  6651. After saving the history, the history file is truncated
  6652. to contain no more than
  6653. <FONT SIZE=-1><B>HISTFILESIZE</B>
  6654. </FONT>
  6655. lines. If
  6656. <FONT SIZE=-1><B>HISTFILESIZE</B>
  6657. </FONT>
  6658. is unset, or set to null, a non-numeric value,
  6659. or a numeric value less than zero, the history file is not truncated.
  6660. <P>
  6661. The builtin command
  6662. <B>fc</B>
  6663. (see
  6664. <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
  6665. </FONT>
  6666. below) may be used to list or edit and re-execute a portion of
  6667. the history list.
  6668. The
  6669. <B>history</B>
  6670. builtin may be used to display or modify the history list and
  6671. manipulate the history file.
  6672. When using command-line editing, search commands
  6673. are available in each editing mode that provide access to the
  6674. history list.
  6675. <P>
  6676. The shell allows control over which commands are saved on the history
  6677. list. The
  6678. <FONT SIZE=-1><B>HISTCONTROL</B>
  6679. </FONT>
  6680. and
  6681. <FONT SIZE=-1><B>HISTIGNORE</B>
  6682. </FONT>
  6683. variables may be set to cause the shell to save only a subset of the
  6684. commands entered.
  6685. The
  6686. <B>cmdhist</B>
  6687. shell option, if enabled, causes the shell to attempt to save each
  6688. line of a multi-line command in the same history entry, adding
  6689. semicolons where necessary to preserve syntactic correctness.
  6690. The
  6691. <B>lithist</B>
  6692. shell option causes the shell to save the command with embedded newlines
  6693. instead of semicolons. See the description of the
  6694. <B>shopt</B>
  6695. builtin below under
  6696. <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
  6697. </FONT>
  6698. for information on setting and unsetting shell options.
  6699. <A NAME="lbCX">&nbsp;</A>
  6700. <H3>HISTORY EXPANSION</H3>
  6701. <P>
  6702. The shell supports a history expansion feature that
  6703. is similar to the history expansion in
  6704. <B>csh.</B>
  6705. This section describes what syntax features are available. This
  6706. feature is enabled by default for interactive shells, and can be
  6707. disabled using the
  6708. <B>+H</B>
  6709. option to the
  6710. <B>set</B>
  6711. builtin command (see
  6712. <FONT SIZE=-1><B>SHELL BUILTIN COMMANDS</B>
  6713. </FONT>
  6714. below). Non-interactive shells do not perform history expansion
  6715. by default.
  6716. <P>
  6717. History expansions introduce words from the history list into
  6718. the input stream, making it easy to repeat commands, insert the
  6719. arguments to a previous command into the current input line, or
  6720. fix errors in previous commands quickly.
  6721. <P>
  6722. History expansion is performed immediately after a complete line
  6723. is read, before the shell breaks it into words.
  6724. It takes place in two parts.
  6725. The first is to determine which line from the history list
  6726. to use during substitution.
  6727. The second is to select portions of that line for inclusion into
  6728. the current one.
  6729. The line selected from the history is the <I>event</I>,
  6730. and the portions of that line that are acted upon are <I>words</I>.
  6731. Various <I>modifiers</I> are available to manipulate the selected words.
  6732. The line is broken into words in the same fashion as when reading input,
  6733. so that several <I>metacharacter</I>-separated words surrounded by
  6734. quotes are considered one word.
  6735. History expansions are introduced by the appearance of the
  6736. history expansion character, which is <B>!</B> by default.
  6737. Only backslash (<B>\</B>) and single quotes can quote
  6738. the history expansion character, but the history expansion character is
  6739. also treated as quoted if it immediately precedes the closing double quote
  6740. in a double-quoted string.
  6741. <P>
  6742. Several characters inhibit history expansion if found immediately
  6743. following the history expansion character, even if it is unquoted:
  6744. space, tab, newline, carriage return, and <B>=</B>.
  6745. If the <B>extglob</B> shell option is enabled, <B>(</B> will also
  6746. inhibit expansion.
  6747. <P>
  6748. Several shell options settable with the
  6749. <B>shopt</B>
  6750. builtin may be used to tailor the behavior of history expansion.
  6751. If the
  6752. <B>histverify</B>
  6753. shell option is enabled (see the description of the
  6754. <B>shopt</B>
  6755. builtin below), and
  6756. <B>readline</B>
  6757. is being used, history substitutions are not immediately passed to
  6758. the shell parser.
  6759. Instead, the expanded line is reloaded into the
  6760. <B>readline</B>
  6761. editing buffer for further modification.
  6762. If
  6763. <B>readline</B>
  6764. is being used, and the
  6765. <B>histreedit</B>
  6766. shell option is enabled, a failed history substitution will be reloaded
  6767. into the
  6768. <B>readline</B>
  6769. editing buffer for correction.
  6770. The
  6771. <B>-p</B>
  6772. option to the
  6773. <B>history</B>
  6774. builtin command may be used to see what a history expansion will
  6775. do before using it.
  6776. The
  6777. <B>-s</B>
  6778. option to the
  6779. <B>history</B>
  6780. builtin may be used to add commands to the end of the history list
  6781. without actually executing them, so that they are available for
  6782. subsequent recall.
  6783. <P>
  6784. The shell allows control of the various characters used by the
  6785. history expansion mechanism (see the description of
  6786. <B>histchars</B>
  6787. above under
  6788. <B>Shell Variables</B>).
  6789. The shell uses
  6790. the history comment character to mark history timestamps when
  6791. writing the history file.
  6792. <A NAME="lbCY">&nbsp;</A>
  6793. <H4>Event Designators</H4>
  6794. <P>
  6795. An event designator is a reference to a command line entry in the
  6796. history list.
  6797. Unless the reference is absolute, events are relative to the current
  6798. position in the history list.
  6799. <P>
  6800. <DL COMPACT>
  6801. <DT><B>!</B>
  6802. <DD>
  6803. Start a history substitution, except when followed by a
  6804. <B>blank</B>,
  6805. newline, carriage return, =
  6806. or ( (when the <B>extglob</B> shell option is enabled using
  6807. the <B>shopt</B> builtin).
  6808. <DT><B>!</B><I>n</I>
  6809. <DD>
  6810. Refer to command line
  6811. <I>n</I>.
  6812. <DT><B>!-</B><I>n</I>
  6813. <DD>
  6814. Refer to the current command minus
  6815. <I>n</I>.
  6816. <DT><B>!!</B>
  6817. <DD>
  6818. Refer to the previous command. This is a synonym for `!-1'.
  6819. <DT><B>!</B><I>string</I>
  6820. <DD>
  6821. Refer to the most recent command preceding the current position in the
  6822. history list starting with
  6823. <I>string</I>.
  6824. <DT><B>!?</B><I>string</I><B>[?]</B>
  6825. <DD>
  6826. Refer to the most recent command preceding the current position in the
  6827. history list containing
  6828. <I>string</I>.
  6829. The trailing <B>?</B> may be omitted if
  6830. <I>string</I>
  6831. is followed immediately by a newline.
  6832. <DT><B></B><FONT SIZE=+2><B>^</B></FONT><B></B><I>string1</I><FONT SIZE=+2>^</FONT><I>string2</I><FONT SIZE=+2>^</FONT>
  6833. <DD>
  6834. Quick substitution. Repeat the previous command, replacing
  6835. <I>string1</I>
  6836. with
  6837. <I>string2</I>.
  6838. Equivalent to
  6839. ``!!:s/<I>string1</I>/<I>string2</I>/''
  6840. (see <B>Modifiers</B> below).
  6841. <DT><B>!#</B>
  6842. <DD>
  6843. The entire command line typed so far.
  6844. </DL>
  6845. <A NAME="lbCZ">&nbsp;</A>
  6846. <H4>Word Designators</H4>
  6847. <P>
  6848. Word designators are used to select desired words from the event.
  6849. A
  6850. <B>:</B>
  6851. separates the event specification from the word designator.
  6852. It may be omitted if the word designator begins with a
  6853. <B>^</B>,
  6854. <B>$</B>,
  6855. <B>*</B>,
  6856. <B>-</B>,
  6857. or
  6858. <B>%</B>.
  6859. Words are numbered from the beginning of the line,
  6860. with the first word being denoted by 0 (zero).
  6861. Words are inserted into the current line separated by single spaces.
  6862. <P>
  6863. <DL COMPACT>
  6864. <DT><B>0 (zero)</B>
  6865. <DD>
  6866. The zeroth word. For the shell, this is the command
  6867. word.
  6868. <DT><I>n</I>
  6869. <DD>
  6870. The <I>n</I>th word.
  6871. <DT><B>^</B>
  6872. <DD>
  6873. The first argument. That is, word 1.
  6874. <DT><B>$</B>
  6875. <DD>
  6876. The last word. This is usually the last argument, but will expand to the
  6877. zeroth word if there is only one word in the line.
  6878. <DT><B>%</B>
  6879. <DD>
  6880. The word matched by the most recent `?<I>string</I>?' search.
  6881. <DT><I>x</I><B>-</B>y
  6882. <DD>
  6883. A range of words; `-<I>y</I>' abbreviates `0-<I>y</I>'.
  6884. <DT><B>*</B>
  6885. <DD>
  6886. All of the words but the zeroth. This is a synonym
  6887. for `<I>1-$</I>'. It is not an error to use
  6888. <B>*</B>
  6889. if there is just one
  6890. word in the event; the empty string is returned in that case.
  6891. <DT><B>x*</B>
  6892. <DD>
  6893. Abbreviates <I>x-$</I>.
  6894. <DT><B>x-</B>
  6895. <DD>
  6896. Abbreviates <I>x-$</I> like <B>x*</B>, but omits the last word.
  6897. </DL>
  6898. <P>
  6899. If a word designator is supplied without an event specification, the
  6900. previous command is used as the event.
  6901. <A NAME="lbDA">&nbsp;</A>
  6902. <H4>Modifiers</H4>
  6903. <P>
  6904. After the optional word designator, there may appear a sequence of
  6905. one or more of the following modifiers, each preceded by a `:'.
  6906. <P>
  6907. <P>
  6908. <DL COMPACT>
  6909. <DT><B>h</B>
  6910. <DD>
  6911. Remove a trailing filename component, leaving only the head.
  6912. <DT><B>t</B>
  6913. <DD>
  6914. Remove all leading filename components, leaving the tail.
  6915. <DT><B>r</B>
  6916. <DD>
  6917. Remove a trailing suffix of the form <I>.xxx</I>, leaving the
  6918. basename.
  6919. <DT><B>e</B>
  6920. <DD>
  6921. Remove all but the trailing suffix.
  6922. <DT><B>p</B>
  6923. <DD>
  6924. Print the new command but do not execute it.
  6925. <DT><B>q</B>
  6926. <DD>
  6927. Quote the substituted words, escaping further substitutions.
  6928. <DT><B>x</B>
  6929. <DD>
  6930. Quote the substituted words as with
  6931. <B>q</B>,
  6932. but break into words at
  6933. <B>blanks</B>
  6934. and newlines.
  6935. <DT><B>s/</B><I>old</I>/<I>new</I>/
  6936. <DD>
  6937. Substitute
  6938. <I>new</I>
  6939. for the first occurrence of
  6940. <I>old</I>
  6941. in the event line. Any delimiter can be used in place of /. The
  6942. final delimiter is optional if it is the last character of the
  6943. event line. The delimiter may be quoted in
  6944. <I>old</I>
  6945. and
  6946. <I>new</I>
  6947. with a single backslash. If &amp; appears in
  6948. <I>new</I>,
  6949. it is replaced by
  6950. <I>old</I>.
  6951. A single backslash will quote the &amp;. If
  6952. <I>old</I>
  6953. is null, it is set to the last
  6954. <I>old</I>
  6955. substituted, or, if no previous history substitutions took place,
  6956. the last
  6957. <I>string</I>
  6958. in a
  6959. <B>!?</B><I>string</I><B>[?]</B>
  6960. search.
  6961. <DT><B>&amp;</B>
  6962. <DD>
  6963. Repeat the previous substitution.
  6964. <DT><B>g</B>
  6965. <DD>
  6966. Cause changes to be applied over the entire event line. This is
  6967. used in conjunction with `<B>:s</B>' (e.g., `<B>:gs/</B><I>old</I>/<I>new</I>/')
  6968. or `<B>:&amp;</B>'. If used with
  6969. `<B>:s</B>', any delimiter can be used
  6970. in place of /, and the final delimiter is optional
  6971. if it is the last character of the event line.
  6972. An <B>a</B> may be used as a synonym for <B>g</B>.
  6973. <DT><B>G</B>
  6974. <DD>
  6975. Apply the following `<B>s</B>' modifier once to each word in the event line.
  6976. </DL>
  6977. <A NAME="lbDB">&nbsp;</A>
  6978. <H3>SHELL BUILTIN COMMANDS</H3>
  6979. <P>
  6980. Unless otherwise noted, each builtin command documented in this
  6981. section as accepting options preceded by
  6982. <B>-</B>
  6983. accepts
  6984. <B>--</B>
  6985. to signify the end of the options.
  6986. The <B>:</B>, <B>true</B>, <B>false</B>, and <B>test</B> builtins
  6987. do not accept options and do not treat <B>--</B> specially.
  6988. The <B>exit</B>, <B>logout</B>, <B>return</B>,
  6989. <B>break</B>, <B>continue</B>, <B>let</B>,
  6990. and <B>shift</B> builtins accept and process arguments beginning with
  6991. <B>-</B> without requiring <B>--</B>.
  6992. Other builtins that accept arguments but are not specified as accepting
  6993. options interpret arguments beginning with <B>-</B> as invalid options and
  6994. require <B>--</B> to prevent this interpretation.
  6995. <P>
  6996. <DL COMPACT>
  6997. <DT><B>:</B> [<I>arguments</I>]<DD>
  6998. No effect; the command does nothing beyond expanding
  6999. <I>arguments</I>
  7000. and performing any specified
  7001. redirections.
  7002. The return status is zero.
  7003. <DT><B> . </B> <I>filename</I> [<I>arguments</I>]<DD>
  7004. <DT><B>source</B> <I>filename</I> [<I>arguments</I>]<DD>
  7005. Read and execute commands from
  7006. <I>filename</I>
  7007. in the current
  7008. shell environment and return the exit status of the last command
  7009. executed from
  7010. <I>filename</I>.
  7011. If
  7012. <I>filename</I>
  7013. does not contain a slash, filenames in
  7014. <FONT SIZE=-1><B>PATH</B>
  7015. </FONT>
  7016. are used to find the directory containing
  7017. <I>filename</I>.
  7018. The file searched for in
  7019. <FONT SIZE=-1><B>PATH</B>
  7020. </FONT>
  7021. need not be executable.
  7022. When <B>bash</B> is not in <I>posix mode</I>, the current directory is
  7023. searched if no file is found in
  7024. <FONT SIZE=-1><B>PATH</B>.
  7025. </FONT>
  7026. If the
  7027. <B>sourcepath</B>
  7028. option to the
  7029. <B>shopt</B>
  7030. builtin command is turned off, the
  7031. <FONT SIZE=-1><B>PATH</B>
  7032. </FONT>
  7033. is not searched.
  7034. If any <I>arguments</I> are supplied, they become the positional
  7035. parameters when <I>filename</I> is executed. Otherwise the positional
  7036. parameters are unchanged.
  7037. If the <B>-T</B> option is enabled, <B>source</B> inherits any trap on
  7038. <B>DEBUG</B>; if it is not, any <B>DEBUG</B> trap string is saved and
  7039. restored around the call to <B>source</B>, and <B>source</B> unsets the
  7040. <B>DEBUG</B> trap while it executes.
  7041. If <B>-T</B> is not set, and the sourced file changes
  7042. the <B>DEBUG</B> trap, the new value is retained when <B>source</B> completes.
  7043. The return status is the status of the last command exited within
  7044. the script (0 if no commands are executed), and false if
  7045. <I>filename</I>
  7046. is not found or cannot be read.
  7047. <DT><B>alias</B> [<B>-p</B>] [<I>name</I>[=<I>value</I>] ...]<DD>
  7048. <B>Alias</B> with no arguments or with the
  7049. <B>-p</B>
  7050. option prints the list of aliases in the form
  7051. <B>alias</B> <I>name</I>=<I>value</I> on standard output.
  7052. When arguments are supplied, an alias is defined for
  7053. each <I>name</I> whose <I>value</I> is given.
  7054. A trailing space in <I>value</I> causes the next word to be
  7055. checked for alias substitution when the alias is expanded.
  7056. For each <I>name</I> in the argument list for which no <I>value</I>
  7057. is supplied, the name and value of the alias is printed.
  7058. <B>Alias</B> returns true unless a <I>name</I> is given for which
  7059. no alias has been defined.
  7060. <DT><B>bg</B> [<I>jobspec</I> ...]<DD>
  7061. Resume each suspended job <I>jobspec</I> in the background, as if it
  7062. had been started with
  7063. <B>&amp;</B>.
  7064. If
  7065. <I>jobspec</I>
  7066. is not present, the shell's notion of the <I>current job</I> is used.
  7067. <B>bg</B>
  7068. <I>jobspec</I>
  7069. returns 0 unless run when job control is disabled or, when run with
  7070. job control enabled, any specified <I>jobspec</I> was not found
  7071. or was started without job control.
  7072. <DT><B>bind</B> [<B>-m</B> <I>keymap</I>] [<B>-lpsvPSVX</B>]<DD>
  7073. <DT><B>bind</B> [<B>-m</B> <I>keymap</I>] [<B>-q</B> <I>function</I>] [<B>-u</B> <I>function</I>] [<B>-r</B> <I>keyseq</I>]<DD>
  7074. <DT><B>bind</B> [<B>-m</B> <I>keymap</I>] <B>-f</B> <I>filename</I><DD>
  7075. <DT><B>bind</B> [<B>-m</B> <I>keymap</I>] <B>-x</B> <I>keyseq</I>:<I>shell-command</I><DD>
  7076. <DT><B>bind</B> [<B>-m</B> <I>keymap</I>] <I>keyseq</I>:<I>function-name</I><DD>
  7077. <DT><B>bind</B> [<B>-m</B> <I>keymap</I>] <I>keyseq</I>:<I>readline-command</I><DD>
  7078. Display current
  7079. <B>readline</B>
  7080. key and function bindings, bind a key sequence to a
  7081. <B>readline</B>
  7082. function or macro, or set a
  7083. <B>readline</B>
  7084. variable.
  7085. Each non-option argument is a command as it would appear in
  7086. <I>.inputrc</I>,
  7087. but each binding or command must be passed as a separate argument;
  7088. e.g., '&quot;\C-x\C-r&quot;: re-read-init-file'.
  7089. Options, if supplied, have the following meanings:
  7090. <DL COMPACT><DT><DD>
  7091. <DL COMPACT>
  7092. <DT><B>-m </B><I>keymap</I>
  7093. <DD>
  7094. Use
  7095. <I>keymap</I>
  7096. as the keymap to be affected by the subsequent bindings.
  7097. Acceptable
  7098. <I>keymap</I>
  7099. names are
  7100. <I>emacs, emacs-standard, emacs-meta, emacs-ctlx, vi,
  7101. vi-move, vi-command</I>, and
  7102. <I>vi-insert</I>.
  7103. <I>vi</I> is equivalent to <I>vi-command</I> (<I>vi-move</I> is also
  7104. a synonym); <I>emacs</I> is
  7105. equivalent to <I>emacs-standard</I>.
  7106. <DT><B>-l</B>
  7107. <DD>
  7108. List the names of all <B>readline</B> functions.
  7109. <DT><B>-p</B>
  7110. <DD>
  7111. Display <B>readline</B> function names and bindings in such a way
  7112. that they can be re-read.
  7113. <DT><B>-P</B>
  7114. <DD>
  7115. List current <B>readline</B> function names and bindings.
  7116. <DT><B>-s</B>
  7117. <DD>
  7118. Display <B>readline</B> key sequences bound to macros and the strings
  7119. they output in such a way that they can be re-read.
  7120. <DT><B>-S</B>
  7121. <DD>
  7122. Display <B>readline</B> key sequences bound to macros and the strings
  7123. they output.
  7124. <DT><B>-v</B>
  7125. <DD>
  7126. Display <B>readline</B> variable names and values in such a way that they
  7127. can be re-read.
  7128. <DT><B>-V</B>
  7129. <DD>
  7130. List current <B>readline</B> variable names and values.
  7131. <DT><B>-f </B><I>filename</I>
  7132. <DD>
  7133. Read key bindings from <I>filename</I>.
  7134. <DT><B>-q </B><I>function</I>
  7135. <DD>
  7136. Query about which keys invoke the named <I>function</I>.
  7137. <DT><B>-u </B><I>function</I>
  7138. <DD>
  7139. Unbind all keys bound to the named <I>function</I>.
  7140. <DT><B>-r </B><I>keyseq</I>
  7141. <DD>
  7142. Remove any current binding for <I>keyseq</I>.
  7143. <DT><B>-x </B><I>keyseq</I>:<I>shell-command</I>
  7144. <DD>
  7145. Cause <I>shell-command</I> to be executed whenever <I>keyseq</I> is
  7146. entered.
  7147. When <I>shell-command</I> is executed, the shell sets the
  7148. <FONT SIZE=-1><B>READLINE_LINE</B>
  7149. </FONT>
  7150. variable to the contents of the <B>readline</B> line buffer and the
  7151. <FONT SIZE=-1><B>READLINE_POINT</B>
  7152. </FONT>
  7153. variable to the current location of the insertion point.
  7154. If the executed command changes the value of
  7155. <FONT SIZE=-1><B>READLINE_LINE</B>
  7156. </FONT>
  7157. or
  7158. <FONT SIZE=-1><B>READLINE_POINT</B>,
  7159. </FONT>
  7160. those new values will be reflected in the editing state.
  7161. <DT><B>-X</B>
  7162. <DD>
  7163. List all key sequences bound to shell commands and the associated commands
  7164. in a format that can be reused as input.
  7165. </DL>
  7166. <P>
  7167. The return value is 0 unless an unrecognized option is given or an
  7168. error occurred.
  7169. </DL>
  7170. <DT><B>break</B> [<I>n</I>]<DD>
  7171. Exit from within a
  7172. <B>for</B>,
  7173. <B>while</B>,
  7174. <B>until</B>,
  7175. or
  7176. <B>select</B>
  7177. loop. If <I>n</I> is specified, break <I>n</I> levels.
  7178. <I>n</I>
  7179. must be >= 1. If
  7180. <I>n</I>
  7181. is greater than the number of enclosing loops, all enclosing loops
  7182. are exited.
  7183. The return value is 0 unless <I>n</I> is not greater than or equal to 1.
  7184. <DT><B>builtin</B> <I>shell-builtin</I> [<I>arguments</I>]<DD>
  7185. Execute the specified shell builtin, passing it
  7186. <I>arguments</I>,
  7187. and return its exit status.
  7188. This is useful when defining a
  7189. function whose name is the same as a shell builtin,
  7190. retaining the functionality of the builtin within the function.
  7191. The <B>cd</B> builtin is commonly redefined this way.
  7192. The return status is false if
  7193. <I>shell-builtin</I>
  7194. is not a shell builtin command.
  7195. <DT><B>caller</B> [<I>expr</I>]<DD>
  7196. Returns the context of any active subroutine call (a shell function or
  7197. a script executed with the <B>.</B> or <B>source</B> builtins).
  7198. Without <I>expr</I>, <B>caller</B> displays the line number and source
  7199. filename of the current subroutine call.
  7200. If a non-negative integer is supplied as <I>expr</I>, <B>caller</B>
  7201. displays the line number, subroutine name, and source file corresponding
  7202. to that position in the current execution call stack. This extra
  7203. information may be used, for example, to print a stack trace. The
  7204. current frame is frame 0.
  7205. The return value is 0 unless the shell is not executing a subroutine
  7206. call or <I>expr</I> does not correspond to a valid position in the
  7207. call stack.
  7208. <DT><B>cd</B> [<B>-L</B>|[<B>-P</B> [<B>-e</B>]] [-@]] [<I>dir</I>]<DD>
  7209. Change the current directory to <I>dir</I>.
  7210. if <I>dir</I> is not supplied, the value of the
  7211. <FONT SIZE=-1><B>HOME</B>
  7212. </FONT>
  7213. shell variable is the default.
  7214. Any additional arguments following <I>dir</I> are ignored.
  7215. The variable
  7216. <FONT SIZE=-1><B>CDPATH</B>
  7217. </FONT>
  7218. defines the search path for the directory containing
  7219. <I>dir</I>:
  7220. each directory name in
  7221. <FONT SIZE=-1><B>CDPATH</B>
  7222. </FONT>
  7223. is searched for <I>dir</I>.
  7224. Alternative directory names in
  7225. <FONT SIZE=-1><B>CDPATH</B>
  7226. </FONT>
  7227. are separated by a colon (:). A null directory name in
  7228. <FONT SIZE=-1><B>CDPATH</B>
  7229. </FONT>
  7230. is the same as the current directory, i.e., ``<B>.</B>''. If
  7231. <I>dir</I>
  7232. begins with a slash (/),
  7233. then
  7234. <FONT SIZE=-1><B>CDPATH</B>
  7235. </FONT>
  7236. is not used. The
  7237. <B>-P</B>
  7238. option causes <B>cd</B> to use the physical directory structure
  7239. by resolving symbolic links while traversing <I>dir</I> and
  7240. before processing instances of <I>..</I> in <I>dir</I> (see also the
  7241. <B>-P</B>
  7242. option to the
  7243. <B>set</B>
  7244. builtin command); the
  7245. <B>-L</B>
  7246. option forces symbolic links to be followed by resolving the link
  7247. after processing instances of <I>..</I> in <I>dir</I>.
  7248. If <I>..</I> appears in <I>dir</I>, it is processed by removing the
  7249. immediately previous pathname component from <I>dir</I>, back to a slash
  7250. or the beginning of <I>dir</I>.
  7251. If the
  7252. <B>-e</B>
  7253. option is supplied with
  7254. <B>-P</B>,
  7255. and the current working directory cannot be successfully determined
  7256. after a successful directory change, <B>cd</B> will return an unsuccessful
  7257. status.
  7258. On systems that support it, the <B>-@</B> option presents the extended
  7259. attributes associated with a file as a directory.
  7260. An argument of
  7261. <B>-</B>
  7262. is converted to
  7263. <FONT SIZE=-1><B>$OLDPWD</B>
  7264. </FONT>
  7265. before the directory change is attempted.
  7266. If a non-empty directory name from
  7267. <FONT SIZE=-1><B>CDPATH</B>
  7268. </FONT>
  7269. is used, or if
  7270. <B>-</B> is the first argument, and the directory change is
  7271. successful, the absolute pathname of the new working directory is
  7272. written to the standard output.
  7273. The return value is true if the directory was successfully changed;
  7274. false otherwise.
  7275. <DT><B>command</B> [<B>-pVv</B>] <I>command</I> [<I>arg</I> ...]<DD>
  7276. Run
  7277. <I>command</I>
  7278. with
  7279. <I>args</I>
  7280. suppressing the normal shell function lookup.
  7281. Only builtin commands or commands found in the
  7282. <FONT SIZE=-1><B>PATH</B>
  7283. </FONT>
  7284. are executed. If the
  7285. <B>-p</B>
  7286. option is given, the search for
  7287. <I>command</I>
  7288. is performed using a default value for
  7289. <FONT SIZE=-1><B>PATH</B>
  7290. </FONT>
  7291. that is guaranteed to find all of the standard utilities.
  7292. If either the
  7293. <B>-V</B>
  7294. or
  7295. <B>-v</B>
  7296. option is supplied, a description of
  7297. <I>command</I>
  7298. is printed. The
  7299. <B>-v</B>
  7300. option causes a single word indicating the command or filename
  7301. used to invoke
  7302. <I>command</I>
  7303. to be displayed; the
  7304. <B>-V</B>
  7305. option produces a more verbose description.
  7306. If the
  7307. <B>-V</B>
  7308. or
  7309. <B>-v</B>
  7310. option is supplied, the exit status is 0 if
  7311. <I>command</I>
  7312. was found, and 1 if not. If neither option is supplied and
  7313. an error occurred or
  7314. <I>command</I>
  7315. cannot be found, the exit status is 127. Otherwise, the exit status of the
  7316. <B>command</B>
  7317. builtin is the exit status of
  7318. <I>command</I>.
  7319. <DT><B>compgen</B> [<I>option</I>] [<I>word</I>]<DD>
  7320. Generate possible completion matches for <I>word</I> according to
  7321. the <I>option</I>s, which may be any option accepted by the
  7322. <B>complete</B>
  7323. builtin with the exception of <B>-p</B> and <B>-r</B>, and write
  7324. the matches to the standard output.
  7325. When using the <B>-F</B> or <B>-C</B> options, the various shell variables
  7326. set by the programmable completion facilities, while available, will not
  7327. have useful values.
  7328. <P>
  7329. The matches will be generated in the same way as if the programmable
  7330. completion code had generated them directly from a completion specification
  7331. with the same flags.
  7332. If <I>word</I> is specified, only those completions matching <I>word</I>
  7333. will be displayed.
  7334. <P>
  7335. The return value is true unless an invalid option is supplied, or no
  7336. matches were generated.
  7337. <DT><B>complete</B> [<B>-abcdefgjksuv</B>] [<B>-o</B> <I>comp-option</I>] [<B>-DE</B>] [<B>-A</B> <I>action</I>] [<B>-G</B> <I>globpat</I>] [<B>-W</B> <I>wordlist</I>] [<B>-F</B> <I>function</I>] [<B>-C</B> <I>command</I>]<DD>
  7338. <BR>
  7339. [<B>-X</B> <I>filterpat</I>] [<B>-P</B> <I>prefix</I>] [<B>-S</B> <I>suffix</I>] <I>name</I> [<I>name ...</I>]
  7340. <DT><B>complete</B> <B>-pr</B> [<B>-DE</B>] [<I>name</I> ...]<DD>
  7341. Specify how arguments to each <I>name</I> should be completed.
  7342. If the <B>-p</B> option is supplied, or if no options are supplied,
  7343. existing completion specifications are printed in a way that allows
  7344. them to be reused as input.
  7345. The <B>-r</B> option removes a completion specification for
  7346. each <I>name</I>, or, if no <I>name</I>s are supplied, all
  7347. completion specifications.
  7348. The <B>-D</B> option indicates that the remaining options and actions should
  7349. apply to the ``default'' command completion; that is, completion attempted
  7350. on a command for which no completion has previously been defined.
  7351. The <B>-E</B> option indicates that the remaining options and actions should
  7352. apply to ``empty'' command completion; that is, completion attempted on a
  7353. blank line.
  7354. <P>
  7355. The process of applying these completion specifications when word completion
  7356. is attempted is described above under <B>Programmable Completion</B>.
  7357. <P>
  7358. Other options, if specified, have the following meanings.
  7359. The arguments to the <B>-G</B>, <B>-W</B>, and <B>-X</B> options
  7360. (and, if necessary, the <B>-P</B> and <B>-S</B> options)
  7361. should be quoted to protect them from expansion before the
  7362. <B>complete</B>
  7363. builtin is invoked.
  7364. <DL COMPACT><DT><DD>
  7365. <DL COMPACT>
  7366. <DT><B>-o</B> <I>comp-option</I><DD>
  7367. The <I>comp-option</I> controls several aspects of the compspec's behavior
  7368. beyond the simple generation of completions.
  7369. <I>comp-option</I> may be one of:
  7370. <DL COMPACT><DT><DD>
  7371. <DL COMPACT>
  7372. <DT><B>bashdefault</B>
  7373. <DD>
  7374. Perform the rest of the default <B>bash</B> completions if the compspec
  7375. generates no matches.
  7376. <DT><B>default</B>
  7377. <DD>
  7378. Use readline's default filename completion if the compspec generates
  7379. no matches.
  7380. <DT><B>dirnames</B>
  7381. <DD>
  7382. Perform directory name completion if the compspec generates no matches.
  7383. <DT><B>filenames</B>
  7384. <DD>
  7385. Tell readline that the compspec generates filenames, so it can perform any
  7386. filename-specific processing (like adding a slash to directory names,
  7387. quoting special characters, or suppressing trailing spaces).
  7388. Intended to be used with shell functions.
  7389. <DT><B>noquote</B>
  7390. <DD>
  7391. Tell readline not to quote the completed words if they are filenames
  7392. (quoting filenames is the default).
  7393. <DT><B>nosort</B>
  7394. <DD>
  7395. Tell readline not to sort the list of possible completions alphabetically.
  7396. <DT><B>nospace</B>
  7397. <DD>
  7398. Tell readline not to append a space (the default) to words completed at
  7399. the end of the line.
  7400. <DT><B>plusdirs</B>
  7401. <DD>
  7402. After any matches defined by the compspec are generated,
  7403. directory name completion is attempted and any
  7404. matches are added to the results of the other actions.
  7405. </DL></DL>
  7406. <DT><B>-A</B> <I>action</I><DD>
  7407. The <I>action</I> may be one of the following to generate a list of possible
  7408. completions:
  7409. <DL COMPACT><DT><DD>
  7410. <DL COMPACT>
  7411. <DT><B>alias</B>
  7412. <DD>
  7413. Alias names. May also be specified as <B>-a</B>.
  7414. <DT><B>arrayvar</B>
  7415. <DD>
  7416. Array variable names.
  7417. <DT><B>binding</B>
  7418. <DD>
  7419. <B>Readline</B> key binding names.
  7420. <DT><B>builtin</B>
  7421. <DD>
  7422. Names of shell builtin commands. May also be specified as <B>-b</B>.
  7423. <DT><B>command</B>
  7424. <DD>
  7425. Command names. May also be specified as <B>-c</B>.
  7426. <DT><B>directory</B>
  7427. <DD>
  7428. Directory names. May also be specified as <B>-d</B>.
  7429. <DT><B>disabled</B>
  7430. <DD>
  7431. Names of disabled shell builtins.
  7432. <DT><B>enabled</B>
  7433. <DD>
  7434. Names of enabled shell builtins.
  7435. <DT><B>export</B>
  7436. <DD>
  7437. Names of exported shell variables. May also be specified as <B>-e</B>.
  7438. <DT><B>file</B>
  7439. <DD>
  7440. File names. May also be specified as <B>-f</B>.
  7441. <DT><B>function</B>
  7442. <DD>
  7443. Names of shell functions.
  7444. <DT><B>group</B>
  7445. <DD>
  7446. Group names. May also be specified as <B>-g</B>.
  7447. <DT><B>helptopic</B>
  7448. <DD>
  7449. Help topics as accepted by the <B>help</B> builtin.
  7450. <DT><B>hostname</B>
  7451. <DD>
  7452. Hostnames, as taken from the file specified by the
  7453. <FONT SIZE=-1><B>HOSTFILE</B>
  7454. </FONT>
  7455. shell variable.
  7456. <DT><B>job</B>
  7457. <DD>
  7458. Job names, if job control is active. May also be specified as <B>-j</B>.
  7459. <DT><B>keyword</B>
  7460. <DD>
  7461. Shell reserved words. May also be specified as <B>-k</B>.
  7462. <DT><B>running</B>
  7463. <DD>
  7464. Names of running jobs, if job control is active.
  7465. <DT><B>service</B>
  7466. <DD>
  7467. Service names. May also be specified as <B>-s</B>.
  7468. <DT><B>setopt</B>
  7469. <DD>
  7470. Valid arguments for the <B>-o</B> option to the <B>set</B> builtin.
  7471. <DT><B>shopt</B>
  7472. <DD>
  7473. Shell option names as accepted by the <B>shopt</B> builtin.
  7474. <DT><B>signal</B>
  7475. <DD>
  7476. Signal names.
  7477. <DT><B>stopped</B>
  7478. <DD>
  7479. Names of stopped jobs, if job control is active.
  7480. <DT><B>user</B>
  7481. <DD>
  7482. User names. May also be specified as <B>-u</B>.
  7483. <DT><B>variable</B>
  7484. <DD>
  7485. Names of all shell variables. May also be specified as <B>-v</B>.
  7486. </DL></DL>
  7487. <DT><B>-C</B> <I>command</I><DD>
  7488. <I>command</I> is executed in a subshell environment, and its output is
  7489. used as the possible completions.
  7490. <DT><B>-F</B> <I>function</I><DD>
  7491. The shell function <I>function</I> is executed in the current shell
  7492. environment.
  7493. When the function is executed,
  7494. the first argument (<B>$1</B>) is the name of the command whose arguments are
  7495. being completed,
  7496. the second argument (<B>$2</B>) is the word being completed,
  7497. and the third argument (<B>$3</B>) is the word preceding the word being
  7498. completed on the current command line.
  7499. When it finishes, the possible completions are retrieved from the value
  7500. of the
  7501. <FONT SIZE=-1><B>COMPREPLY</B>
  7502. </FONT>
  7503. array variable.
  7504. <DT><B>-G</B> <I>globpat</I><DD>
  7505. The pathname expansion pattern <I>globpat</I> is expanded to generate
  7506. the possible completions.
  7507. <DT><B>-P</B> <I>prefix</I><DD>
  7508. <I>prefix</I> is added at the beginning of each possible completion
  7509. after all other options have been applied.
  7510. <DT><B>-S</B> <I>suffix</I><DD>
  7511. <I>suffix</I> is appended to each possible completion
  7512. after all other options have been applied.
  7513. <DT><B>-W</B> <I>wordlist</I><DD>
  7514. The <I>wordlist</I> is split using the characters in the
  7515. <FONT SIZE=-1><B>IFS</B>
  7516. </FONT>
  7517. special variable as delimiters, and each resultant word is expanded.
  7518. The possible completions are the members of the resultant list which
  7519. match the word being completed.
  7520. <DT><B>-X</B> <I>filterpat</I><DD>
  7521. <I>filterpat</I> is a pattern as used for pathname expansion.
  7522. It is applied to the list of possible completions generated by the
  7523. preceding options and arguments, and each completion matching
  7524. <I>filterpat</I> is removed from the list.
  7525. A leading <B>!</B> in <I>filterpat</I> negates the pattern; in this
  7526. case, any completion not matching <I>filterpat</I> is removed.
  7527. </DL>
  7528. <P>
  7529. The return value is true unless an invalid option is supplied, an option
  7530. other than <B>-p</B> or <B>-r</B> is supplied without a <I>name</I>
  7531. argument, an attempt is made to remove a completion specification for
  7532. a <I>name</I> for which no specification exists, or
  7533. an error occurs adding a completion specification.
  7534. </DL>
  7535. <DT><B>compopt</B> [<B>-o</B> <I>option</I>] [<B>-DE</B>] [<B>+o</B> <I>option</I>] [<I>name</I>]<DD>
  7536. Modify completion options for each <I>name</I> according to the
  7537. <I>option</I>s, or for the
  7538. currently-executing completion if no <I>name</I>s are supplied.
  7539. If no <I>option</I>s are given, display the completion options for each
  7540. <I>name</I> or the current completion.
  7541. The possible values of <I>option</I> are those valid for the <B>complete</B>
  7542. builtin described above.
  7543. The <B>-D</B> option indicates that the remaining options should
  7544. apply to the ``default'' command completion; that is, completion attempted
  7545. on a command for which no completion has previously been defined.
  7546. The <B>-E</B> option indicates that the remaining options should
  7547. apply to ``empty'' command completion; that is, completion attempted on a
  7548. blank line.
  7549. <P>
  7550. The return value is true unless an invalid option is supplied, an attempt
  7551. is made to modify the options for a <I>name</I> for which no completion
  7552. specification exists, or an output error occurs.
  7553. <DT><B>continue</B> [<I>n</I>]<DD>
  7554. Resume the next iteration of the enclosing
  7555. <B>for</B>,
  7556. <B>while</B>,
  7557. <B>until</B>,
  7558. or
  7559. <B>select</B>
  7560. loop.
  7561. If
  7562. <I>n</I>
  7563. is specified, resume at the <I>n</I>th enclosing loop.
  7564. <I>n</I>
  7565. must be >= 1. If
  7566. <I>n</I>
  7567. is greater than the number of enclosing loops, the last enclosing loop
  7568. (the ``top-level'' loop) is resumed.
  7569. The return value is 0 unless <I>n</I> is not greater than or equal to 1.
  7570. <DT><B>declare</B> [<B>-aAfFgilnrtux</B>] [<B>-p</B>] [<I>name</I>[=<I>value</I>] ...]<DD>
  7571. <DT><B>typeset</B> [<B>-aAfFgilnrtux</B>] [<B>-p</B>] [<I>name</I>[=<I>value</I>] ...]<DD>
  7572. Declare variables and/or give them attributes.
  7573. If no <I>name</I>s are given then display the values of variables.
  7574. The
  7575. <B>-p</B>
  7576. option will display the attributes and values of each
  7577. <I>name</I>.
  7578. When
  7579. <B>-p</B>
  7580. is used with <I>name</I> arguments, additional options,
  7581. other than <B>-f</B> and <B>-F</B>, are ignored.
  7582. When
  7583. <B>-p</B>
  7584. is supplied without <I>name</I> arguments, it will display the attributes
  7585. and values of all variables having the attributes specified by the
  7586. additional options.
  7587. If no other options are supplied with <B>-p</B>, <B>declare</B> will display
  7588. the attributes and values of all shell variables. The <B>-f</B> option
  7589. will restrict the display to shell functions.
  7590. The
  7591. <B>-F</B>
  7592. option inhibits the display of function definitions; only the
  7593. function name and attributes are printed.
  7594. If the <B>extdebug</B> shell option is enabled using <B>shopt</B>,
  7595. the source file name and line number where each <I>name</I>
  7596. is defined are displayed as well. The
  7597. <B>-F</B>
  7598. option implies
  7599. <B>-f</B>.
  7600. The
  7601. <B>-g</B>
  7602. option forces variables to be created or modified at the global scope,
  7603. even when <B>declare</B> is executed in a shell function.
  7604. It is ignored in all other cases.
  7605. The following options can
  7606. be used to restrict output to variables with the specified attribute or
  7607. to give variables attributes:
  7608. <DL COMPACT><DT><DD>
  7609. <DL COMPACT>
  7610. <DT><B>-a</B>
  7611. <DD>
  7612. Each <I>name</I> is an indexed array variable (see
  7613. <B>Arrays</B>
  7614. above).
  7615. <DT><B>-A</B>
  7616. <DD>
  7617. Each <I>name</I> is an associative array variable (see
  7618. <B>Arrays</B>
  7619. above).
  7620. <DT><B>-f</B>
  7621. <DD>
  7622. Use function names only.
  7623. <DT><B>-i</B>
  7624. <DD>
  7625. The variable is treated as an integer; arithmetic evaluation (see
  7626. <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>
  7627. </FONT>
  7628. above) is performed when the variable is assigned a value.
  7629. <DT><B>-l</B>
  7630. <DD>
  7631. When the variable is assigned a value, all upper-case characters are
  7632. converted to lower-case.
  7633. The upper-case attribute is disabled.
  7634. <DT><B>-n</B>
  7635. <DD>
  7636. Give each <I>name</I> the <I>nameref</I> attribute, making
  7637. it a name reference to another variable.
  7638. That other variable is defined by the value of <I>name</I>.
  7639. All references, assignments, and attribute modifications
  7640. to <I>name</I>, except those using or changing the
  7641. <B>-n</B> attribute itself, are performed on the variable referenced by
  7642. <I>name</I>'s value.
  7643. The nameref attribute cannot be applied to array variables.
  7644. <DT><B>-r</B>
  7645. <DD>
  7646. Make <I>name</I>s readonly. These names cannot then be assigned values
  7647. by subsequent assignment statements or unset.
  7648. <DT><B>-t</B>
  7649. <DD>
  7650. Give each <I>name</I> the <I>trace</I> attribute.
  7651. Traced functions inherit the <B>DEBUG</B> and <B>RETURN</B> traps from
  7652. the calling shell.
  7653. The trace attribute has no special meaning for variables.
  7654. <DT><B>-u</B>
  7655. <DD>
  7656. When the variable is assigned a value, all lower-case characters are
  7657. converted to upper-case.
  7658. The lower-case attribute is disabled.
  7659. <DT><B>-x</B>
  7660. <DD>
  7661. Mark <I>name</I>s for export to subsequent commands via the environment.
  7662. </DL>
  7663. <P>
  7664. Using `+' instead of `-'
  7665. turns off the attribute instead,
  7666. with the exceptions that <B>+a</B>
  7667. may not be used to destroy an array variable and <B>+r</B> will not
  7668. remove the readonly attribute.
  7669. When used in a function,
  7670. <B>declare</B>
  7671. and
  7672. <B>typeset</B>
  7673. make each
  7674. <I>name</I> local, as with the
  7675. <B>local</B>
  7676. command,
  7677. unless the <B>-g</B> option is supplied.
  7678. If a variable name is followed by =<I>value</I>, the value of
  7679. the variable is set to <I>value</I>.
  7680. When using <B>-a</B> or <B>-A</B> and the compound assignment syntax to
  7681. create array variables, additional attributes do not take effect until
  7682. subsequent assignments.
  7683. The return value is 0 unless an invalid option is encountered,
  7684. an attempt is made to define a function using
  7685. <TT>-f foo=bar</TT>,
  7686. an attempt is made to assign a value to a readonly variable,
  7687. an attempt is made to assign a value to an array variable without
  7688. using the compound assignment syntax (see
  7689. <B>Arrays</B>
  7690. above), one of the <I>names</I> is not a valid shell variable name,
  7691. an attempt is made to turn off readonly status for a readonly variable,
  7692. an attempt is made to turn off array status for an array variable,
  7693. or an attempt is made to display a non-existent function with <B>-f</B>.
  7694. </DL>
  7695. <DT><B>dirs [-clpv</B>] [+<I>n</I>] [-<I>n</I>]
  7696. <DD>
  7697. Without options, displays the list of currently remembered directories.
  7698. The default display is on a single line with directory names separated
  7699. by spaces.
  7700. Directories are added to the list with the
  7701. <B>pushd</B>
  7702. command; the
  7703. <B>popd</B>
  7704. command removes entries from the list.
  7705. The current directory is always the first directory in the stack.
  7706. <DL COMPACT><DT><DD>
  7707. <DL COMPACT>
  7708. <DT><B>-c</B>
  7709. <DD>
  7710. Clears the directory stack by deleting all of the entries.
  7711. <DT><B>-l</B>
  7712. <DD>
  7713. Produces a listing using full pathnames;
  7714. the default listing format uses a tilde to denote the home directory.
  7715. <DT><B>-p</B>
  7716. <DD>
  7717. Print the directory stack with one entry per line.
  7718. <DT><B>-v</B>
  7719. <DD>
  7720. Print the directory stack with one entry per line,
  7721. prefixing each entry with its index in the stack.
  7722. <DT><B>+</B><I>n</I><DD>
  7723. Displays the <I>n</I>th entry counting from the left of the list
  7724. shown by
  7725. <B>dirs</B>
  7726. when invoked without options, starting with zero.
  7727. <DT><B>-</B><I>n</I><DD>
  7728. Displays the <I>n</I>th entry counting from the right of the list
  7729. shown by
  7730. <B>dirs</B>
  7731. when invoked without options, starting with zero.
  7732. </DL>
  7733. <P>
  7734. The return value is 0 unless an
  7735. invalid option is supplied or <I>n</I> indexes beyond the end
  7736. of the directory stack.
  7737. </DL>
  7738. <DT><B>disown</B> [<B>-ar</B>] [<B>-h</B>] [<I>jobspec</I> ... | <I>pid</I> ... ]<DD>
  7739. Without options, remove each
  7740. <I>jobspec</I>
  7741. from the table of active jobs.
  7742. If
  7743. <I>jobspec</I>
  7744. is not present, and neither the <B>-a</B> nor the <B>-r</B> option
  7745. is supplied, the <I>current job</I> is used.
  7746. If the <B>-h</B> option is given, each
  7747. <I>jobspec</I>
  7748. is not removed from the table, but is marked so that
  7749. <FONT SIZE=-1><B>SIGHUP</B>
  7750. </FONT>
  7751. is not sent to the job if the shell receives a
  7752. <FONT SIZE=-1><B>SIGHUP</B>.
  7753. </FONT>
  7754. If no
  7755. <I>jobspec</I>
  7756. is supplied, the
  7757. <B>-a</B>
  7758. option means to remove or mark all jobs; the
  7759. <B>-r</B>
  7760. option without a
  7761. <I>jobspec</I>
  7762. argument restricts operation to running jobs.
  7763. The return value is 0 unless a
  7764. <I>jobspec</I>
  7765. does not specify a valid job.
  7766. <DT><B>echo</B> [<B>-neE</B>] [<I>arg</I> ...]<DD>
  7767. Output the <I>arg</I>s, separated by spaces, followed by a newline.
  7768. The return status is 0 unless a write error occurs.
  7769. If <B>-n</B> is specified, the trailing newline is
  7770. suppressed. If the <B>-e</B> option is given, interpretation of
  7771. the following backslash-escaped characters is enabled. The
  7772. <B>-E</B>
  7773. option disables the interpretation of these escape characters,
  7774. even on systems where they are interpreted by default.
  7775. The <B>xpg_echo</B> shell option may be used to
  7776. dynamically determine whether or not <B>echo</B> expands these
  7777. escape characters by default.
  7778. <B>echo</B>
  7779. does not interpret <B>--</B> to mean the end of options.
  7780. <B>echo</B>
  7781. interprets the following escape sequences:
  7782. <DL COMPACT><DT><DD>
  7783. <DL COMPACT>
  7784. <DT><B>\a</B>
  7785. <DD>
  7786. alert (bell)
  7787. <DT><B>\b</B>
  7788. <DD>
  7789. backspace
  7790. <DT><B>\c</B>
  7791. <DD>
  7792. suppress further output
  7793. <DT><B>\e</B>
  7794. <DD>
  7795. <DT><B>\E</B>
  7796. <DD>
  7797. an escape character
  7798. <DT><B>\f</B>
  7799. <DD>
  7800. form feed
  7801. <DT><B>\n</B>
  7802. <DD>
  7803. new line
  7804. <DT><B>\r</B>
  7805. <DD>
  7806. carriage return
  7807. <DT><B>\t</B>
  7808. <DD>
  7809. horizontal tab
  7810. <DT><B>\v</B>
  7811. <DD>
  7812. vertical tab
  7813. <DT><B>\\</B>
  7814. <DD>
  7815. backslash
  7816. <DT><B>\0</B><I>nnn</I>
  7817. <DD>
  7818. the eight-bit character whose value is the octal value <I>nnn</I>
  7819. (zero to three octal digits)
  7820. <DT><B>\x</B><I>HH</I>
  7821. <DD>
  7822. the eight-bit character whose value is the hexadecimal value <I>HH</I>
  7823. (one or two hex digits)
  7824. <DT><B>\u</B><I>HHHH</I>
  7825. <DD>
  7826. the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value
  7827. <I>HHHH</I> (one to four hex digits)
  7828. <DT><B>\U</B><I>HHHHHHHH</I>
  7829. <DD>
  7830. the Unicode (ISO/IEC 10646) character whose value is the hexadecimal value
  7831. <I>HHHHHHHH</I> (one to eight hex digits)
  7832. </DL></DL>
  7833. <DT><B>enable</B> [<B>-a</B>] [<B>-dnps</B>] [<B>-f</B> <I>filename</I>] [<I>name</I> ...]<DD>
  7834. Enable and disable builtin shell commands.
  7835. Disabling a builtin allows a disk command which has the same name
  7836. as a shell builtin to be executed without specifying a full pathname,
  7837. even though the shell normally searches for builtins before disk commands.
  7838. If <B>-n</B> is used, each <I>name</I>
  7839. is disabled; otherwise,
  7840. <I>names</I> are enabled. For example, to use the
  7841. <B>test</B>
  7842. binary found via the
  7843. <FONT SIZE=-1><B>PATH</B>
  7844. </FONT>
  7845. instead of the shell builtin version, run
  7846. <TT>enable -n test</TT>.
  7847. The
  7848. <B>-f</B>
  7849. option means to load the new builtin command
  7850. <I>name</I>
  7851. from shared object
  7852. <I>filename</I>,
  7853. on systems that support dynamic loading. The
  7854. <B>-d</B>
  7855. option will delete a builtin previously loaded with
  7856. <B>-f</B>.
  7857. If no <I>name</I> arguments are given, or if the
  7858. <B>-p</B>
  7859. option is supplied, a list of shell builtins is printed.
  7860. With no other option arguments, the list consists of all enabled
  7861. shell builtins.
  7862. If <B>-n</B> is supplied, only disabled builtins are printed.
  7863. If <B>-a</B> is supplied, the list printed includes all builtins, with an
  7864. indication of whether or not each is enabled.
  7865. If <B>-s</B> is supplied, the output is restricted to the POSIX
  7866. <I>special</I> builtins.
  7867. The return value is 0 unless a
  7868. <I>name</I>
  7869. is not a shell builtin or there is an error loading a new builtin
  7870. from a shared object.
  7871. <DT><B>eval</B> [<I>arg</I> ...]<DD>
  7872. The <I>arg</I>s are read and concatenated together into a single
  7873. command. This command is then read and executed by the shell, and
  7874. its exit status is returned as the value of
  7875. <B>eval</B>.
  7876. If there are no
  7877. <I>args</I>,
  7878. or only null arguments,
  7879. <B>eval</B>
  7880. returns 0.
  7881. <DT><B>exec</B> [<B>-cl</B>] [<B>-a</B> <I>name</I>] [<I>command</I> [<I>arguments</I>]]<DD>
  7882. If
  7883. <I>command</I>
  7884. is specified, it replaces the shell.
  7885. No new process is created. The
  7886. <I>arguments</I>
  7887. become the arguments to <I>command</I>.
  7888. If the
  7889. <B>-l</B>
  7890. option is supplied,
  7891. the shell places a dash at the beginning of the zeroth argument passed to
  7892. <I>command</I>.
  7893. This is what
  7894. <I>login</I>(1)
  7895. does. The
  7896. <B>-c</B>
  7897. option causes
  7898. <I>command</I>
  7899. to be executed with an empty environment. If
  7900. <B>-a</B>
  7901. is supplied, the shell passes
  7902. <I>name</I>
  7903. as the zeroth argument to the executed command.
  7904. If
  7905. <I>command</I>
  7906. cannot be executed for some reason, a non-interactive shell exits,
  7907. unless the
  7908. <B>execfail</B>
  7909. shell option
  7910. is enabled. In that case, it returns failure.
  7911. An interactive shell returns failure if the file cannot be executed.
  7912. If
  7913. <I>command</I>
  7914. is not specified, any redirections take effect in the current shell,
  7915. and the return status is 0. If there is a redirection error, the
  7916. return status is 1.
  7917. <DT><B>exit</B> [<I>n</I>]<DD>
  7918. Cause the shell to exit
  7919. with a status of <I>n</I>. If
  7920. <I>n</I>
  7921. is omitted, the exit status
  7922. is that of the last command executed.
  7923. A trap on
  7924. <FONT SIZE=-1><B>EXIT</B>
  7925. </FONT>
  7926. is executed before the shell terminates.
  7927. <DT><B>export</B> [<B>-fn</B>] [<I>name</I>[=<I>word</I>]] ...<DD>
  7928. <DT><B>export -p</B>
  7929. <DD>
  7930. The supplied
  7931. <I>names</I>
  7932. are marked for automatic export to the environment of
  7933. subsequently executed commands. If the
  7934. <B>-f</B>
  7935. option is given, the
  7936. <I>names</I>
  7937. refer to functions.
  7938. If no
  7939. <I>names</I>
  7940. are given, or if the
  7941. <B>-p</B>
  7942. option is supplied, a list
  7943. of names of all exported variables is printed.
  7944. The
  7945. <B>-n</B>
  7946. option causes the export property to be removed from each
  7947. <I>name</I>.
  7948. If a variable name is followed by =<I>word</I>, the value of
  7949. the variable is set to <I>word</I>.
  7950. <B>export</B>
  7951. returns an exit status of 0 unless an invalid option is
  7952. encountered,
  7953. one of the <I>names</I> is not a valid shell variable name, or
  7954. <B>-f</B>
  7955. is supplied with a
  7956. <I>name</I>
  7957. that is not a function.
  7958. <DT><B>fc</B> [<B>-e</B> <I>ename</I>] [<B>-lnr</B>] [<I>first</I>] [<I>last</I>]<DD>
  7959. <DT><B>fc</B> <B>-s</B> [<I>pat</I>=<I>rep</I>] [<I>cmd</I>]<DD>
  7960. The first form selects a range of commands from
  7961. <I>first</I>
  7962. to
  7963. <I>last</I>
  7964. from the history list and displays or edits and re-executes them.
  7965. <I>First</I>
  7966. and
  7967. <I>last</I>
  7968. may be specified as a string (to locate the last command beginning
  7969. with that string) or as a number (an index into the history list,
  7970. where a negative number is used as an offset from the current
  7971. command number). If
  7972. <I>last</I>
  7973. is not specified it is set to
  7974. the current command for listing (so that
  7975. <TT>fc -l -10</TT>
  7976. prints the last 10 commands) and to
  7977. <I>first</I>
  7978. otherwise.
  7979. If
  7980. <I>first</I>
  7981. is not specified it is set to the previous
  7982. command for editing and -16 for listing.
  7983. <P>
  7984. The
  7985. <B>-n</B>
  7986. option suppresses
  7987. the command numbers when listing. The
  7988. <B>-r</B>
  7989. option reverses the order of
  7990. the commands. If the
  7991. <B>-l</B>
  7992. option is given,
  7993. the commands are listed on
  7994. standard output. Otherwise, the editor given by
  7995. <I>ename</I>
  7996. is invoked
  7997. on a file containing those commands. If
  7998. <I>ename</I>
  7999. is not given, the
  8000. value of the
  8001. <FONT SIZE=-1><B>FCEDIT</B>
  8002. </FONT>
  8003. variable is used, and
  8004. the value of
  8005. <FONT SIZE=-1><B>EDITOR</B>
  8006. </FONT>
  8007. if
  8008. <FONT SIZE=-1><B>FCEDIT</B>
  8009. </FONT>
  8010. is not set. If neither variable is set,
  8011. <I>vi</I>
  8012. is used. When editing is complete, the edited commands are
  8013. echoed and executed.
  8014. <P>
  8015. In the second form, <I>command</I> is re-executed after each instance
  8016. of <I>pat</I> is replaced by <I>rep</I>.
  8017. <I>Command</I> is intepreted the same as <I>first</I> above.
  8018. A useful alias to use with this is
  8019. <TT>r='fc -s'</TT>,
  8020. so that typing
  8021. <TT>r cc</TT>
  8022. runs the last command beginning with
  8023. <TT>cc</TT>
  8024. and typing
  8025. <TT>r</TT>
  8026. re-executes the last command.
  8027. <P>
  8028. If the first form is used, the return value is 0 unless an invalid
  8029. option is encountered or
  8030. <I>first</I>
  8031. or
  8032. <I>last</I>
  8033. specify history lines out of range.
  8034. If the
  8035. <B>-e</B>
  8036. option is supplied, the return value is the value of the last
  8037. command executed or failure if an error occurs with the temporary
  8038. file of commands. If the second form is used, the return status
  8039. is that of the command re-executed, unless
  8040. <I>cmd</I>
  8041. does not specify a valid history line, in which case
  8042. <B>fc</B>
  8043. returns failure.
  8044. <DT><B>fg</B> [<I>jobspec</I>]<DD>
  8045. Resume
  8046. <I>jobspec</I>
  8047. in the foreground, and make it the current job.
  8048. If
  8049. <I>jobspec</I>
  8050. is not present, the shell's notion of the <I>current job</I> is used.
  8051. The return value is that of the command placed into the foreground,
  8052. or failure if run when job control is disabled or, when run with
  8053. job control enabled, if
  8054. <I>jobspec</I>
  8055. does not specify a valid job or
  8056. <I>jobspec</I>
  8057. specifies a job that was started without job control.
  8058. <DT><B>getopts</B> <I>optstring</I> <I>name</I> [<I>args</I>]<DD>
  8059. <B>getopts</B>
  8060. is used by shell procedures to parse positional parameters.
  8061. <I>optstring</I>
  8062. contains the option characters to be recognized; if a character
  8063. is followed by a colon, the option is expected to have an
  8064. argument, which should be separated from it by white space.
  8065. The colon and question mark characters may not be used as
  8066. option characters.
  8067. Each time it is invoked,
  8068. <B>getopts</B>
  8069. places the next option in the shell variable
  8070. <I>name</I>,
  8071. initializing
  8072. <I>name</I>
  8073. if it does not exist,
  8074. and the index of the next argument to be processed into the
  8075. variable
  8076. <FONT SIZE=-1><B>OPTIND</B>.
  8077. </FONT>
  8078. <FONT SIZE=-1><B>OPTIND</B>
  8079. </FONT>
  8080. is initialized to 1 each time the shell or a shell script
  8081. is invoked. When an option requires an argument,
  8082. <B>getopts</B>
  8083. places that argument into the variable
  8084. <FONT SIZE=-1><B>OPTARG</B>.
  8085. </FONT>
  8086. The shell does not reset
  8087. <FONT SIZE=-1><B>OPTIND</B>
  8088. </FONT>
  8089. automatically; it must be manually reset between multiple
  8090. calls to
  8091. <B>getopts</B>
  8092. within the same shell invocation if a new set of parameters
  8093. is to be used.
  8094. <P>
  8095. When the end of options is encountered, <B>getopts</B> exits with a
  8096. return value greater than zero.
  8097. <FONT SIZE=-1><B>OPTIND</B>
  8098. </FONT>
  8099. is set to the index of the first non-option argument,
  8100. and <I>name</I> is set to ?.
  8101. <P>
  8102. <B>getopts</B>
  8103. normally parses the positional parameters, but if more arguments are
  8104. given in
  8105. <I>args</I>,
  8106. <B>getopts</B>
  8107. parses those instead.
  8108. <P>
  8109. <B>getopts</B>
  8110. can report errors in two ways. If the first character of
  8111. <I>optstring</I>
  8112. is a colon,
  8113. <I>silent</I>
  8114. error reporting is used. In normal operation, diagnostic messages
  8115. are printed when invalid options or missing option arguments are
  8116. encountered.
  8117. If the variable
  8118. <FONT SIZE=-1><B>OPTERR</B>
  8119. </FONT>
  8120. is set to 0, no error messages will be displayed, even if the first
  8121. character of
  8122. <I>optstring</I>
  8123. is not a colon.
  8124. <P>
  8125. If an invalid option is seen,
  8126. <B>getopts</B>
  8127. places ? into
  8128. <I>name</I>
  8129. and, if not silent,
  8130. prints an error message and unsets
  8131. <FONT SIZE=-1><B>OPTARG</B>.
  8132. </FONT>
  8133. If
  8134. <B>getopts</B>
  8135. is silent,
  8136. the option character found is placed in
  8137. <FONT SIZE=-1><B>OPTARG</B>
  8138. </FONT>
  8139. and no diagnostic message is printed.
  8140. <P>
  8141. If a required argument is not found, and
  8142. <B>getopts</B>
  8143. is not silent,
  8144. a question mark (<B>?</B>) is placed in
  8145. <I>name</I>,
  8146. <FONT SIZE=-1><B>OPTARG</B>
  8147. </FONT>
  8148. is unset, and a diagnostic message is printed.
  8149. If
  8150. <B>getopts</B>
  8151. is silent, then a colon (<B>:</B>) is placed in
  8152. <I>name</I>
  8153. and
  8154. <FONT SIZE=-1><B>OPTARG</B>
  8155. </FONT>
  8156. is set to the option character found.
  8157. <P>
  8158. <B>getopts</B>
  8159. returns true if an option, specified or unspecified, is found.
  8160. It returns false if the end of options is encountered or an
  8161. error occurs.
  8162. <DT><B>hash</B> [<B>-lr</B>] [<B>-p</B> <I>filename</I>] [<B>-dt</B>] [<I>name</I>]<DD>
  8163. Each time <B>hash</B> is invoked,
  8164. the full pathname of the command
  8165. <I>name</I>
  8166. is determined by searching
  8167. the directories in
  8168. <B>$PATH</B>
  8169. and remembered. Any previously-remembered pathname is discarded.
  8170. If the
  8171. <B>-p</B>
  8172. option is supplied, no path search is performed, and
  8173. <I>filename</I>
  8174. is used as the full filename of the command.
  8175. The
  8176. <B>-r</B>
  8177. option causes the shell to forget all
  8178. remembered locations.
  8179. The
  8180. <B>-d</B>
  8181. option causes the shell to forget the remembered location of each <I>name</I>.
  8182. If the
  8183. <B>-t</B>
  8184. option is supplied, the full pathname to which each <I>name</I> corresponds
  8185. is printed. If multiple <I>name</I> arguments are supplied with <B>-t</B>,
  8186. the <I>name</I> is printed before the hashed full pathname.
  8187. The
  8188. <B>-l</B>
  8189. option causes output to be displayed in a format that may be reused as input.
  8190. If no arguments are given, or if only <B>-l</B> is supplied,
  8191. information about remembered commands is printed.
  8192. The return status is true unless a
  8193. <I>name</I>
  8194. is not found or an invalid option is supplied.
  8195. <DT><B>help</B> [<B>-dms</B>] [<I>pattern</I>]<DD>
  8196. Display helpful information about builtin commands. If
  8197. <I>pattern</I>
  8198. is specified,
  8199. <B>help</B>
  8200. gives detailed help on all commands matching
  8201. <I>pattern</I>;
  8202. otherwise help for all the builtins and shell control structures
  8203. is printed.
  8204. <DL COMPACT><DT><DD>
  8205. <DL COMPACT>
  8206. <DT><B>-d</B>
  8207. <DD>
  8208. Display a short description of each <I>pattern</I>
  8209. <DT><B>-m</B>
  8210. <DD>
  8211. Display the description of each <I>pattern</I> in a manpage-like format
  8212. <DT><B>-s</B>
  8213. <DD>
  8214. Display only a short usage synopsis for each <I>pattern</I>
  8215. </DL>
  8216. <P>
  8217. The return status is 0 unless no command matches
  8218. <I>pattern</I>.
  8219. </DL>
  8220. <DT><B>history [</B><I>n</I>]<DD>
  8221. <DT><B>history</B> <B>-c</B><DD>
  8222. <DT><B>history -d</B> <I>offset</I><DD>
  8223. <DT><B>history</B> <B>-anrw</B> [<I>filename</I>]<DD>
  8224. <DT><B>history</B> <B>-p</B> <I>arg</I> [<I>arg ...</I>]<DD>
  8225. <DT><B>history</B> <B>-s</B> <I>arg</I> [<I>arg ...</I>]<DD>
  8226. With no options, display the command
  8227. history list with line numbers. Lines listed
  8228. with a
  8229. <B>*</B>
  8230. have been modified. An argument of
  8231. <I>n</I>
  8232. lists only the last
  8233. <I>n</I>
  8234. lines.
  8235. If the shell variable
  8236. <FONT SIZE=-1><B>HISTTIMEFORMAT</B>
  8237. </FONT>
  8238. is set and not null,
  8239. it is used as a format string for <I>strftime</I>(3) to display
  8240. the time stamp associated with each displayed history entry.
  8241. No intervening blank is printed between the formatted time stamp
  8242. and the history line.
  8243. If <I>filename</I> is supplied, it is used as the
  8244. name of the history file; if not, the value of
  8245. <FONT SIZE=-1><B>HISTFILE</B>
  8246. </FONT>
  8247. is used. Options, if supplied, have the following meanings:
  8248. <DL COMPACT><DT><DD>
  8249. <DL COMPACT>
  8250. <DT><B>-c</B>
  8251. <DD>
  8252. Clear the history list by deleting all the entries.
  8253. <DT><B>-d</B> <I>offset</I><DD>
  8254. Delete the history entry at position <I>offset</I>.
  8255. <DT><B>-a</B>
  8256. <DD>
  8257. Append the ``new'' history lines to the history file.
  8258. These are history lines entered since the beginning of the current
  8259. <B>bash</B> session, but not already appended to the history file.
  8260. <DT><B>-n</B>
  8261. <DD>
  8262. Read the history lines not already read from the history
  8263. file into the current history list. These are lines
  8264. appended to the history file since the beginning of the
  8265. current <B>bash</B> session.
  8266. <DT><B>-r</B>
  8267. <DD>
  8268. Read the contents of the history file
  8269. and append them to the current history list.
  8270. <DT><B>-w</B>
  8271. <DD>
  8272. Write the current history list to the history file, overwriting the
  8273. history file's contents.
  8274. <DT><B>-p</B>
  8275. <DD>
  8276. Perform history substitution on the following <I>args</I> and display
  8277. the result on the standard output.
  8278. Does not store the results in the history list.
  8279. Each <I>arg</I> must be quoted to disable normal history expansion.
  8280. <DT><B>-s</B>
  8281. <DD>
  8282. Store the
  8283. <I>args</I>
  8284. in the history list as a single entry. The last command in the
  8285. history list is removed before the
  8286. <I>args</I>
  8287. are added.
  8288. </DL>
  8289. <P>
  8290. If the
  8291. <FONT SIZE=-1><B>HISTTIMEFORMAT</B>
  8292. </FONT>
  8293. variable is set, the time stamp information
  8294. associated with each history entry is written to the history file,
  8295. marked with the history comment character.
  8296. When the history file is read, lines beginning with the history
  8297. comment character followed immediately by a digit are interpreted
  8298. as timestamps for the following history entry.
  8299. The return value is 0 unless an invalid option is encountered, an
  8300. error occurs while reading or writing the history file, an invalid
  8301. <I>offset</I> is supplied as an argument to <B>-d</B>, or the
  8302. history expansion supplied as an argument to <B>-p</B> fails.
  8303. </DL>
  8304. <DT><B>jobs</B> [<B>-lnprs</B>] [ <I>jobspec</I> ... ]<DD>
  8305. <DT><B>jobs</B> <B>-x</B> <I>command</I> [ <I>args</I> ... ]<DD>
  8306. The first form lists the active jobs. The options have the following
  8307. meanings:
  8308. <DL COMPACT><DT><DD>
  8309. <DL COMPACT>
  8310. <DT><B>-l</B>
  8311. <DD>
  8312. List process IDs
  8313. in addition to the normal information.
  8314. <DT><B>-n</B>
  8315. <DD>
  8316. Display information only about jobs that have changed status since
  8317. the user was last notified of their status.
  8318. <DT><B>-p</B>
  8319. <DD>
  8320. List only the process ID of the job's process group
  8321. leader.
  8322. <DT><B>-r</B>
  8323. <DD>
  8324. Display only running jobs.
  8325. <DT><B>-s</B>
  8326. <DD>
  8327. Display only stopped jobs.
  8328. </DL>
  8329. <P>
  8330. If
  8331. <I>jobspec</I>
  8332. is given, output is restricted to information about that job.
  8333. The return status is 0 unless an invalid option is encountered
  8334. or an invalid
  8335. <I>jobspec</I>
  8336. is supplied.
  8337. <P>
  8338. If the
  8339. <B>-x</B>
  8340. option is supplied,
  8341. <B>jobs</B>
  8342. replaces any
  8343. <I>jobspec</I>
  8344. found in
  8345. <I>command</I>
  8346. or
  8347. <I>args</I>
  8348. with the corresponding process group ID, and executes
  8349. <I>command</I>
  8350. passing it
  8351. <I>args</I>,
  8352. returning its exit status.
  8353. </DL>
  8354. <DT><B>kill</B> [<B>-s</B> <I>sigspec</I> | <B>-n</B> <I>signum</I> | <B>-</B><I>sigspec</I>] [<I>pid</I> | <I>jobspec</I>] ...<DD>
  8355. <DT><B>kill</B> <B>-l</B>|<B>-L</B> [<I>sigspec</I> | <I>exit_status</I>]<DD>
  8356. Send the signal named by
  8357. <I>sigspec</I>
  8358. or
  8359. <I>signum</I>
  8360. to the processes named by
  8361. <I>pid</I>
  8362. or
  8363. <I>jobspec</I>.
  8364. <I>sigspec</I>
  8365. is either a case-insensitive signal name such as
  8366. <FONT SIZE=-1><B>SIGKILL</B>
  8367. </FONT>
  8368. (with or without the
  8369. <FONT SIZE=-1><B>SIG</B>
  8370. </FONT>
  8371. prefix) or a signal number;
  8372. <I>signum</I>
  8373. is a signal number.
  8374. If
  8375. <I>sigspec</I>
  8376. is not present, then
  8377. <FONT SIZE=-1><B>SIGTERM</B>
  8378. </FONT>
  8379. is assumed.
  8380. An argument of
  8381. <B>-l</B>
  8382. lists the signal names.
  8383. If any arguments are supplied when
  8384. <B>-l</B>
  8385. is given, the names of the signals corresponding to the arguments are
  8386. listed, and the return status is 0.
  8387. The <I>exit_status</I> argument to
  8388. <B>-l</B>
  8389. is a number specifying either a signal number or the exit status of
  8390. a process terminated by a signal.
  8391. The
  8392. <B>-L</B>
  8393. option is equivalent to <B>-l</B>.
  8394. <B>kill</B>
  8395. returns true if at least one signal was successfully sent, or false
  8396. if an error occurs or an invalid option is encountered.
  8397. <DT><B>let</B> <I>arg</I> [<I>arg</I> ...]<DD>
  8398. Each
  8399. <I>arg</I>
  8400. is an arithmetic expression to be evaluated (see
  8401. <FONT SIZE=-1><B>ARITHMETIC EVALUATION</B>
  8402. </FONT>
  8403. above).
  8404. If the last
  8405. <I>arg</I>
  8406. evaluates to 0,
  8407. <B>let</B>
  8408. returns 1; 0 is returned otherwise.
  8409. <DT><B>local</B> [<I>option</I>] [<I>name</I>[=<I>value</I>] ... | - ]<DD>
  8410. For each argument, a local variable named
  8411. <I>name</I>
  8412. is created, and assigned
  8413. <I>value</I>.
  8414. The <I>option</I> can be any of the options accepted by <B>declare</B>.
  8415. When
  8416. <B>local</B>
  8417. is used within a function, it causes the variable
  8418. <I>name</I>
  8419. to have a visible scope restricted to that function and its children.
  8420. If <I>name</I> is -, the set of shell options is made local to the function
  8421. in which <B>local</B> is invoked: shell options changed using the
  8422. <B>set</B> builtin inside the function are restored to their original values
  8423. when the function returns.
  8424. With no operands,
  8425. <B>local</B>
  8426. writes a list of local variables to the standard output. It is
  8427. an error to use
  8428. <B>local</B>
  8429. when not within a function. The return status is 0 unless
  8430. <B>local</B>
  8431. is used outside a function, an invalid
  8432. <I>name</I>
  8433. is supplied, or
  8434. <I>name</I> is a readonly variable.
  8435. <DT><B>logout</B>
  8436. <DD>
  8437. Exit a login shell.
  8438. <DT><B>mapfile</B> [<B>-d</B> <I>delim</I>] [<B>-n</B> <I>count</I>] [<B>-O</B> <I>origin</I>] [<B>-s</B> <I>count</I>] [<B>-t</B>] [<B>-u</B> <I>fd</I>] [<B>-C</B> <I>callback</I>] [<B>-c</B> <I>quantum</I>] [<I>array</I>]<DD>
  8439. <DT><B>readarray</B> [<B>-d</B> <I>delim</I>] [<B>-n</B> <I>count</I>] [<B>-O</B> <I>origin</I>] [<B>-s</B> <I>count</I>] [<B>-t</B>] [<B>-u</B> <I>fd</I>] [<B>-C</B> <I>callback</I>] [<B>-c</B> <I>quantum</I>] [<I>array</I>]<DD>
  8440. Read lines from the standard input into the indexed array variable
  8441. <I>array</I>,
  8442. or from file descriptor
  8443. <I>fd</I>
  8444. if the
  8445. <B>-u</B>
  8446. option is supplied.
  8447. The variable
  8448. <FONT SIZE=-1><B>MAPFILE</B>
  8449. </FONT>
  8450. is the default <I>array</I>.
  8451. Options, if supplied, have the following meanings:
  8452. <DL COMPACT><DT><DD>
  8453. <DL COMPACT>
  8454. <DT><B>-d</B>
  8455. <DD>
  8456. The first character of <I>delim</I> is used to terminate each input line,
  8457. rather than newline.
  8458. <DT><B>-n</B>
  8459. <DD>
  8460. Copy at most
  8461. <I>count</I>
  8462. lines. If <I>count</I> is 0, all lines are copied.
  8463. <DT><B>-O</B>
  8464. <DD>
  8465. Begin assigning to
  8466. <I>array</I>
  8467. at index
  8468. <I>origin</I>.
  8469. The default index is 0.
  8470. <DT><B>-s</B>
  8471. <DD>
  8472. Discard the first <I>count</I> lines read.
  8473. <DT><B>-t</B>
  8474. <DD>
  8475. Remove a trailing <I>delim</I> (default newline) from each line read.
  8476. <DT><B>-u</B>
  8477. <DD>
  8478. Read lines from file descriptor <I>fd</I> instead of the standard input.
  8479. <DT><B>-C</B>
  8480. <DD>
  8481. Evaluate
  8482. <I>callback</I>
  8483. each time <I>quantum</I> lines are read. The <B>-c</B> option specifies
  8484. <I>quantum</I>.
  8485. <DT><B>-c</B>
  8486. <DD>
  8487. Specify the number of lines read between each call to
  8488. <I>callback</I>.
  8489. </DL>
  8490. <P>
  8491. If
  8492. <B>-C</B>
  8493. is specified without
  8494. <B>-c</B>,
  8495. the default quantum is 5000.
  8496. When <I>callback</I> is evaluated, it is supplied the index of the next
  8497. array element to be assigned and the line to be assigned to that element
  8498. as additional arguments.
  8499. <I>callback</I> is evaluated after the line is read but before the
  8500. array element is assigned.
  8501. <P>
  8502. If not supplied with an explicit origin, <B>mapfile</B> will clear <I>array</I>
  8503. before assigning to it.
  8504. <P>
  8505. <B>mapfile</B> returns successfully unless an invalid option or option
  8506. argument is supplied, <I>array</I> is invalid or unassignable, or if
  8507. <I>array</I> is not an indexed array.
  8508. </DL>
  8509. <DT><B>popd</B> [-<B>n</B>] [+<I>n</I>] [-<I>n</I>]<DD>
  8510. Removes entries from the directory stack. With no arguments,
  8511. removes the top directory from the stack, and performs a
  8512. <B>cd</B>
  8513. to the new top directory.
  8514. Arguments, if supplied, have the following meanings:
  8515. <DL COMPACT><DT><DD>
  8516. <DL COMPACT>
  8517. <DT><B>-n</B>
  8518. <DD>
  8519. Suppresses the normal change of directory when removing directories
  8520. from the stack, so that only the stack is manipulated.
  8521. <DT><B>+</B><I>n</I><DD>
  8522. Removes the <I>n</I>th entry counting from the left of the list
  8523. shown by
  8524. <B>dirs</B>,
  8525. starting with zero. For example:
  8526. <TT>popd +0</TT>
  8527. removes the first directory,
  8528. <TT>popd +1</TT>
  8529. the second.
  8530. <DT><B>-</B><I>n</I><DD>
  8531. Removes the <I>n</I>th entry counting from the right of the list
  8532. shown by
  8533. <B>dirs</B>,
  8534. starting with zero. For example:
  8535. <TT>popd -0</TT>
  8536. removes the last directory,
  8537. <TT>popd -1</TT>
  8538. the next to last.
  8539. </DL>
  8540. <P>
  8541. If the
  8542. <B>popd</B>
  8543. command is successful, a
  8544. <B>dirs</B>
  8545. is performed as well, and the return status is 0.
  8546. <B>popd</B>
  8547. returns false if an invalid option is encountered, the directory stack
  8548. is empty, a non-existent directory stack entry is specified, or the
  8549. directory change fails.
  8550. </DL>
  8551. <DT><B>printf</B> [<B>-v</B> <I>var</I>] <I>format</I> [<I>arguments</I>]<DD>
  8552. Write the formatted <I>arguments</I> to the standard output under the
  8553. control of the <I>format</I>.
  8554. The <B>-v</B> option causes the output to be assigned to the variable
  8555. <I>var</I> rather than being printed to the standard output.
  8556. <P>
  8557. The <I>format</I> is a character string which contains three types of objects:
  8558. plain characters, which are simply copied to standard output, character
  8559. escape sequences, which are converted and copied to the standard output, and
  8560. format specifications, each of which causes printing of the next successive
  8561. <I>argument</I>.
  8562. In addition to the standard <I>printf</I>(1) format specifications,
  8563. <B>printf</B> interprets the following extensions:
  8564. <DL COMPACT><DT><DD>
  8565. <DL COMPACT>
  8566. <DT><B>%b</B>
  8567. <DD>
  8568. causes
  8569. <B>printf</B> to expand backslash escape sequences in the corresponding
  8570. <I>argument</I>
  8571. in the same way as <B>echo -e</B>.
  8572. <DT><B>%q</B>
  8573. <DD>
  8574. causes <B>printf</B> to output the corresponding
  8575. <I>argument</I> in a format that can be reused as shell input.
  8576. <DT><B>%(</B><I>datefmt</I>)T
  8577. <DD>
  8578. causes <B>printf</B> to output the date-time string resulting from using
  8579. <I>datefmt</I> as a format string for <I>strftime</I>(3).
  8580. The corresponding <I>argument</I> is an integer representing the number of
  8581. seconds since the epoch.
  8582. Two special argument values may be used: -1 represents the current
  8583. time, and -2 represents the time the shell was invoked.
  8584. If no argument is specified, conversion behaves as if -1 had been given.
  8585. This is an exception to the usual <B>printf</B> behavior.
  8586. </DL>
  8587. <P>
  8588. Arguments to non-string format specifiers are treated as C constants,
  8589. except that a leading plus or minus sign is allowed, and if the leading
  8590. character is a single or double quote, the value is the ASCII value of
  8591. the following character.
  8592. <P>
  8593. The <I>format</I> is reused as necessary to consume all of the <I>arguments</I>.
  8594. If the <I>format</I> requires more <I>arguments</I> than are supplied, the
  8595. extra format specifications behave as if a zero value or null string, as
  8596. appropriate, had been supplied.
  8597. The return value is zero on success, non-zero on failure.
  8598. </DL>
  8599. <DT><B>pushd</B> [<B>-n</B>] [+<I>n</I>] [-<I>n</I>]<DD>
  8600. <DT><B>pushd</B> [<B>-n</B>] [<I>dir</I>]<DD>
  8601. Adds a directory to the top of the directory stack, or rotates
  8602. the stack, making the new top of the stack the current working
  8603. directory. With no arguments, <B>pushd</B> exchanges the top two directories
  8604. and returns 0, unless the directory stack is empty.
  8605. Arguments, if supplied, have the following meanings:
  8606. <DL COMPACT><DT><DD>
  8607. <DL COMPACT>
  8608. <DT><B>-n</B>
  8609. <DD>
  8610. Suppresses the normal change of directory when rotating or
  8611. adding directories to the stack, so that only the stack is manipulated.
  8612. <DT><B>+</B><I>n</I><DD>
  8613. Rotates the stack so that the <I>n</I>th directory
  8614. (counting from the left of the list shown by
  8615. <B>dirs</B>,
  8616. starting with zero)
  8617. is at the top.
  8618. <DT><B>-</B><I>n</I><DD>
  8619. Rotates the stack so that the <I>n</I>th directory
  8620. (counting from the right of the list shown by
  8621. <B>dirs</B>,
  8622. starting with zero) is at the top.
  8623. <DT><I>dir</I>
  8624. <DD>
  8625. Adds
  8626. <I>dir</I>
  8627. to the directory stack at the top, making it the
  8628. new current working directory as if it had been supplied as the argument
  8629. to the <B>cd</B> builtin.
  8630. </DL>
  8631. <P>
  8632. If the
  8633. <B>pushd</B>
  8634. command is successful, a
  8635. <B>dirs</B>
  8636. is performed as well.
  8637. If the first form is used,
  8638. <B>pushd</B>
  8639. returns 0 unless the cd to
  8640. <I>dir</I>
  8641. fails. With the second form,
  8642. <B>pushd</B>
  8643. returns 0 unless the directory stack is empty,
  8644. a non-existent directory stack element is specified,
  8645. or the directory change to the specified new current directory
  8646. fails.
  8647. </DL>
  8648. <DT><B>pwd</B> [<B>-LP</B>]<DD>
  8649. Print the absolute pathname of the current working directory.
  8650. The pathname printed contains no symbolic links if the
  8651. <B>-P</B>
  8652. option is supplied or the
  8653. <B>-o physical</B>
  8654. option to the
  8655. <B>set</B>
  8656. builtin command is enabled.
  8657. If the
  8658. <B>-L</B>
  8659. option is used, the pathname printed may contain symbolic links.
  8660. The return status is 0 unless an error occurs while
  8661. reading the name of the current directory or an
  8662. invalid option is supplied.
  8663. <DT><B>read</B> [<B>-ers</B>] [<B>-a</B> <I>aname</I>] [<B>-d</B> <I>delim</I>] [<B>-i</B> <I>text</I>] [<B>-n</B> <I>nchars</I>] [<B>-N</B> <I>nchars</I>] [<B>-p</B> <I>prompt</I>] [<B>-t</B> <I>timeout</I>] [<B>-u</B> <I>fd</I>] [<I>name</I> ...]<DD>
  8664. One line is read from the standard input, or from the file descriptor
  8665. <I>fd</I> supplied as an argument to the <B>-u</B> option,
  8666. split into words as described above under <B>Word Splitting</B>,
  8667. and the first word
  8668. is assigned to the first
  8669. <I>name</I>,
  8670. the second word to the second
  8671. <I>name</I>,
  8672. and so on.
  8673. If there are more words than names, the remaining words and their
  8674. intervening delimiters are assigned to the last
  8675. <I>name</I>.
  8676. If there are fewer words read from the input stream than names,
  8677. the remaining names are assigned empty values.
  8678. The characters in
  8679. <FONT SIZE=-1><B>IFS</B>
  8680. </FONT>
  8681. are used to split the line into words using the same rules the shell
  8682. uses for expansion (described above under <B>Word Splitting</B>).
  8683. The backslash character (<B>\</B>) may be used to remove any special
  8684. meaning for the next character read and for line continuation.
  8685. Options, if supplied, have the following meanings:
  8686. <DL COMPACT><DT><DD>
  8687. <DL COMPACT>
  8688. <DT><B>-a </B><I>aname</I>
  8689. <DD>
  8690. The words are assigned to sequential indices
  8691. of the array variable
  8692. <I>aname</I>,
  8693. starting at 0.
  8694. <I>aname</I>
  8695. is unset before any new values are assigned.
  8696. Other <I>name</I> arguments are ignored.
  8697. <DT><B>-d </B><I>delim</I>
  8698. <DD>
  8699. The first character of <I>delim</I> is used to terminate the input line,
  8700. rather than newline.
  8701. <DT><B>-e</B>
  8702. <DD>
  8703. If the standard input
  8704. is coming from a terminal,
  8705. <B>readline</B>
  8706. (see
  8707. <FONT SIZE=-1><B>READLINE</B>
  8708. </FONT>
  8709. above) is used to obtain the line.
  8710. Readline uses the current (or default, if line editing was not previously
  8711. active) editing settings.
  8712. <DT><B>-i </B><I>text</I>
  8713. <DD>
  8714. If
  8715. <B>readline</B>
  8716. is being used to read the line, <I>text</I> is placed into the editing
  8717. buffer before editing begins.
  8718. <DT><B>-n </B><I>nchars</I>
  8719. <DD>
  8720. <B>read</B> returns after reading <I>nchars</I> characters rather than
  8721. waiting for a complete line of input, but honors a delimiter if fewer
  8722. than <I>nchars</I> characters are read before the delimiter.
  8723. <DT><B>-N </B><I>nchars</I>
  8724. <DD>
  8725. <B>read</B> returns after reading exactly <I>nchars</I> characters rather
  8726. than waiting for a complete line of input, unless EOF is encountered or
  8727. <B>read</B> times out.
  8728. Delimiter characters encountered in the input are
  8729. not treated specially and do not cause <B>read</B> to return until
  8730. <I>nchars</I> characters are read.
  8731. The result is not split on the characters in <B>IFS</B>; the intent is
  8732. that the variable is assigned exactly the characters read
  8733. (with the exception of backslash; see the <B>-r</B> option below).
  8734. <DT><B>-p </B><I>prompt</I>
  8735. <DD>
  8736. Display <I>prompt</I> on standard error, without a
  8737. trailing newline, before attempting to read any input. The prompt
  8738. is displayed only if input is coming from a terminal.
  8739. <DT><B>-r</B>
  8740. <DD>
  8741. Backslash does not act as an escape character.
  8742. The backslash is considered to be part of the line.
  8743. In particular, a backslash-newline pair may not be used as a line
  8744. continuation.
  8745. <DT><B>-s</B>
  8746. <DD>
  8747. Silent mode. If input is coming from a terminal, characters are
  8748. not echoed.
  8749. <DT><B>-t </B><I>timeout</I>
  8750. <DD>
  8751. Cause <B>read</B> to time out and return failure if a complete line of
  8752. input (or a specified number of characters)
  8753. is not read within <I>timeout</I> seconds.
  8754. <I>timeout</I> may be a decimal number with a fractional portion following
  8755. the decimal point.
  8756. This option is only effective if <B>read</B> is reading input from a
  8757. terminal, pipe, or other special file; it has no effect when reading
  8758. from regular files.
  8759. If <B>read</B> times out, <B>read</B> saves any partial input read into
  8760. the specified variable <I>name</I>.
  8761. If <I>timeout</I> is 0, <B>read</B> returns immediately, without trying to
  8762. read any data. The exit status is 0 if input is available on
  8763. the specified file descriptor, non-zero otherwise.
  8764. The exit status is greater than 128 if the timeout is exceeded.
  8765. <DT><B>-u </B><I>fd</I>
  8766. <DD>
  8767. Read input from file descriptor <I>fd</I>.
  8768. </DL>
  8769. <P>
  8770. If no
  8771. <I>names</I>
  8772. are supplied, the line read is assigned to the variable
  8773. <FONT SIZE=-1><B>REPLY</B>.
  8774. </FONT>
  8775. The exit status is zero, unless end-of-file is encountered, <B>read</B>
  8776. times out (in which case the status is greater than 128),
  8777. a variable assignment error (such as assigning to a readonly variable) occurs,
  8778. or an invalid file descriptor is supplied as the argument to <B>-u</B>.
  8779. </DL>
  8780. <DT><B>readonly</B> [<B>-aAf</B>] [<B>-p</B>] [<I>name</I>[=<I>word</I>] ...]<DD>
  8781. The given
  8782. <I>names</I> are marked readonly; the values of these
  8783. <I>names</I>
  8784. may not be changed by subsequent assignment.
  8785. If the
  8786. <B>-f</B>
  8787. option is supplied, the functions corresponding to the
  8788. <I>names</I> are so
  8789. marked.
  8790. The
  8791. <B>-a</B>
  8792. option restricts the variables to indexed arrays; the
  8793. <B>-A</B>
  8794. option restricts the variables to associative arrays.
  8795. If both options are supplied,
  8796. <B>-A</B>
  8797. takes precedence.
  8798. If no
  8799. <I>name</I>
  8800. arguments are given, or if the
  8801. <B>-p</B>
  8802. option is supplied, a list of all readonly names is printed.
  8803. The other options may be used to restrict the output to a subset of
  8804. the set of readonly names.
  8805. The
  8806. <B>-p</B>
  8807. option causes output to be displayed in a format that
  8808. may be reused as input.
  8809. If a variable name is followed by =<I>word</I>, the value of
  8810. the variable is set to <I>word</I>.
  8811. The return status is 0 unless an invalid option is encountered,
  8812. one of the
  8813. <I>names</I>
  8814. is not a valid shell variable name, or
  8815. <B>-f</B>
  8816. is supplied with a
  8817. <I>name</I>
  8818. that is not a function.
  8819. <DT><B>return</B> [<I>n</I>]<DD>
  8820. Causes a function to stop executing and return the value specified by
  8821. <I>n</I>
  8822. to its caller.
  8823. If
  8824. <I>n</I>
  8825. is omitted, the return status is that of the last command
  8826. executed in the function body.
  8827. If <B>return</B> is executed by a trap handler, the last command used to
  8828. determine the status is the last command executed before the trap handler.
  8829. if <B>return</B> is executed during a <B>DEBUG</B> trap, the last command
  8830. used to determine the status is the last command executed by the trap
  8831. handler before <B>return</B> was invoked.
  8832. If
  8833. <B>return</B>
  8834. is used outside a function,
  8835. but during execution of a script by the
  8836. <B>.</B>
  8837. (<B>source</B>) command, it causes the shell to stop executing
  8838. that script and return either
  8839. <I>n</I>
  8840. or the exit status of the last command executed within the
  8841. script as the exit status of the script.
  8842. If <I>n</I> is supplied, the return value is its least significant
  8843. 8 bits.
  8844. The return status is non-zero if
  8845. <B>return</B>
  8846. is supplied a non-numeric argument, or
  8847. is used outside a
  8848. function and not during execution of a script by <B>.</B> or <B>source</B>.
  8849. Any command associated with the <B>RETURN</B> trap is executed
  8850. before execution resumes after the function or script.
  8851. <DT><B>set</B> [<B>--abefhkmnptuvxBCEHPT</B>] [<B>-o</B> <I>option-name</I>] [<I>arg</I> ...]<DD>
  8852. <DT><B>set</B> [<B>+abefhkmnptuvxBCEHPT</B>] [<B>+o</B> <I>option-name</I>] [<I>arg</I> ...]<DD>
  8853. Without options, the name and value of each shell variable are displayed
  8854. in a format that can be reused as input
  8855. for setting or resetting the currently-set variables.
  8856. Read-only variables cannot be reset.
  8857. In <I>posix</I> mode, only shell variables are listed.
  8858. The output is sorted according to the current locale.
  8859. When options are specified, they set or unset shell attributes.
  8860. Any arguments remaining after option processing are treated
  8861. as values for the positional parameters and are assigned, in order, to
  8862. <B>$1</B>,
  8863. <B>$2</B>,
  8864. <B>...</B>
  8865. <B>$</B><I>n</I>.
  8866. Options, if specified, have the following meanings:
  8867. <DL COMPACT><DT><DD>
  8868. <DL COMPACT>
  8869. <DT><B>-a</B>
  8870. <DD>
  8871. Each variable or function that is created or modified is given the
  8872. export attribute and marked for export to the environment of
  8873. subsequent commands.
  8874. <DT><B>-b</B>
  8875. <DD>
  8876. Report the status of terminated background jobs
  8877. immediately, rather than before the next primary prompt. This is
  8878. effective only when job control is enabled.
  8879. <DT><B>-e</B>
  8880. <DD>
  8881. Exit immediately if a
  8882. <I>pipeline</I> (which may consist of a single <I>simple command</I>),
  8883. a <I>list</I>,
  8884. or a <I>compound command</I>
  8885. (see
  8886. <FONT SIZE=-1><B>SHELL GRAMMAR</B>
  8887. </FONT>
  8888. above), exits with a non-zero status.
  8889. The shell does not exit if the
  8890. command that fails is part of the command list immediately following a
  8891. <B>while</B>
  8892. or
  8893. <B>until</B>
  8894. keyword,
  8895. part of the test following the
  8896. <B>if</B>
  8897. or
  8898. <B>elif</B>
  8899. reserved words, part of any command executed in a
  8900. <B>&amp;&amp;</B>
  8901. or
  8902. <B>||</B>
  8903. list except the command following the final <B>&amp;&amp;</B> or <B>||</B>,
  8904. any command in a pipeline but the last,
  8905. or if the command's return value is
  8906. being inverted with
  8907. <B>!</B>.
  8908. If a compound command other than a subshell
  8909. returns a non-zero status because a command failed
  8910. while <B>-e</B> was being ignored, the shell does not exit.
  8911. A trap on <B>ERR</B>, if set, is executed before the shell exits.
  8912. This option applies to the shell environment and each subshell environment
  8913. separately (see
  8914. <FONT SIZE=-1><B>COMMAND EXECUTION ENVIRONMENT</B>
  8915. </FONT>
  8916. above), and may cause
  8917. subshells to exit before executing all the commands in the subshell.
  8918. <P>
  8919. If a compound command or shell function executes in a context
  8920. where <B>-e</B> is being ignored,
  8921. none of the commands executed within the compound command or function body
  8922. will be affected by the <B>-e</B> setting, even if <B>-e</B> is set
  8923. and a command returns a failure status.
  8924. If a compound command or shell function sets <B>-e</B> while executing in
  8925. a context where <B>-e</B> is ignored, that setting will not have any
  8926. effect until the compound command or the command containing the function
  8927. call completes.
  8928. <DT><B>-f</B>
  8929. <DD>
  8930. Disable pathname expansion.
  8931. <DT><B>-h</B>
  8932. <DD>
  8933. Remember the location of commands as they are looked up for execution.
  8934. This is enabled by default.
  8935. <DT><B>-k</B>
  8936. <DD>
  8937. All arguments in the form of assignment statements
  8938. are placed in the environment for a command, not just
  8939. those that precede the command name.
  8940. <DT><B>-m</B>
  8941. <DD>
  8942. Monitor mode. Job control is enabled. This option is on
  8943. by default for interactive shells on systems that support
  8944. it (see
  8945. <FONT SIZE=-1><B>JOB CONTROL</B>
  8946. </FONT>
  8947. above).
  8948. All processes run in a separate process group.
  8949. When a background job completes, the shell prints a line
  8950. containing its exit status.
  8951. <DT><B>-n</B>
  8952. <DD>
  8953. Read commands but do not execute them.
  8954. This may be used to check a shell script for syntax errors.
  8955. This is ignored by interactive shells.
  8956. <DT><B>-o </B><I>option-name</I>
  8957. <DD>
  8958. The <I>option-name</I> can be one of the following:
  8959. <DL COMPACT><DT><DD>
  8960. <DL COMPACT>
  8961. <DT><B>allexport</B>
  8962. <DD>
  8963. Same as
  8964. <B>-a</B>.
  8965. <DT><B>braceexpand</B>
  8966. <DD>
  8967. Same as
  8968. <B>-B</B>.
  8969. <DT><B>emacs</B>
  8970. <DD>
  8971. Use an emacs-style command line editing interface. This is enabled
  8972. by default when the shell is interactive, unless the shell is started
  8973. with the
  8974. <B>--noediting</B>
  8975. option.
  8976. This also affects the editing interface used for <B>read -e</B>.
  8977. <DT><B>errexit</B>
  8978. <DD>
  8979. Same as
  8980. <B>-e</B>.
  8981. <DT><B>errtrace</B>
  8982. <DD>
  8983. Same as
  8984. <B>-E</B>.
  8985. <DT><B>functrace</B>
  8986. <DD>
  8987. Same as
  8988. <B>-T</B>.
  8989. <DT><B>hashall</B>
  8990. <DD>
  8991. Same as
  8992. <B>-h</B>.
  8993. <DT><B>histexpand</B>
  8994. <DD>
  8995. Same as
  8996. <B>-H</B>.
  8997. <DT><B>history</B>
  8998. <DD>
  8999. Enable command history, as described above under
  9000. <FONT SIZE=-1><B>HISTORY</B>.
  9001. </FONT>
  9002. This option is on by default in interactive shells.
  9003. <DT><B>ignoreeof</B>
  9004. <DD>
  9005. The effect is as if the shell command
  9006. <TT>IGNOREEOF=10</TT>
  9007. had been executed
  9008. (see
  9009. <B>Shell Variables</B>
  9010. above).
  9011. <DT><B>keyword</B>
  9012. <DD>
  9013. Same as
  9014. <B>-k</B>.
  9015. <DT><B>monitor</B>
  9016. <DD>
  9017. Same as
  9018. <B>-m</B>.
  9019. <DT><B>noclobber</B>
  9020. <DD>
  9021. Same as
  9022. <B>-C</B>.
  9023. <DT><B>noexec</B>
  9024. <DD>
  9025. Same as
  9026. <B>-n</B>.
  9027. <DT><B>noglob</B>
  9028. <DD>
  9029. Same as
  9030. <B>-f</B>.
  9031. <DT><B>nolog</B>
  9032. <DD>
  9033. Currently ignored.
  9034. <DT><B>notify</B>
  9035. <DD>
  9036. Same as
  9037. <B>-b</B>.
  9038. <DT><B>nounset</B>
  9039. <DD>
  9040. Same as
  9041. <B>-u</B>.
  9042. <DT><B>onecmd</B>
  9043. <DD>
  9044. Same as
  9045. <B>-t</B>.
  9046. <DT><B>physical</B>
  9047. <DD>
  9048. Same as
  9049. <B>-P</B>.
  9050. <DT><B>pipefail</B>
  9051. <DD>
  9052. If set, the return value of a pipeline is the value of the last
  9053. (rightmost) command to exit with a non-zero status, or zero if all
  9054. commands in the pipeline exit successfully.
  9055. This option is disabled by default.
  9056. <DT><B>posix</B>
  9057. <DD>
  9058. Change the behavior of
  9059. <B>bash</B>
  9060. where the default operation differs
  9061. from the POSIX standard to match the standard (<I>posix mode</I>).
  9062. See
  9063. <FONT SIZE=-1><B>SEE ALSO</B>
  9064. </FONT>
  9065. below for a reference to a document that details how posix mode affects
  9066. bash's behavior.
  9067. <DT><B>privileged</B>
  9068. <DD>
  9069. Same as
  9070. <B>-p</B>.
  9071. <DT><B>verbose</B>
  9072. <DD>
  9073. Same as
  9074. <B>-v</B>.
  9075. <DT><B>vi</B>
  9076. <DD>
  9077. Use a vi-style command line editing interface.
  9078. This also affects the editing interface used for <B>read -e</B>.
  9079. <DT><B>xtrace</B>
  9080. <DD>
  9081. Same as
  9082. <B>-x</B>.
  9083. <P>
  9084. </DL>
  9085. <P>
  9086. If
  9087. <B>-o</B>
  9088. is supplied with no <I>option-name</I>, the values of the current options are
  9089. printed.
  9090. If
  9091. <B>+o</B>
  9092. is supplied with no <I>option-name</I>, a series of
  9093. <B>set</B>
  9094. commands to recreate the current option settings is displayed on
  9095. the standard output.
  9096. </DL>
  9097. <DT><B>-p</B>
  9098. <DD>
  9099. Turn on
  9100. <I>privileged</I>
  9101. mode. In this mode, the
  9102. <FONT SIZE=-1><B>$ENV</B>
  9103. </FONT>
  9104. and
  9105. <FONT SIZE=-1><B>$BASH_ENV</B>
  9106. </FONT>
  9107. files are not processed, shell functions are not inherited from the
  9108. environment, and the
  9109. <FONT SIZE=-1><B>SHELLOPTS</B>,
  9110. </FONT>
  9111. <FONT SIZE=-1><B>BASHOPTS</B>,
  9112. </FONT>
  9113. <FONT SIZE=-1><B>CDPATH</B>,
  9114. </FONT>
  9115. and
  9116. <FONT SIZE=-1><B>GLOBIGNORE</B>
  9117. </FONT>
  9118. variables, if they appear in the environment, are ignored.
  9119. If the shell is started with the effective user (group) id not equal to the
  9120. real user (group) id, and the <B>-p</B> option is not supplied, these actions
  9121. are taken and the effective user id is set to the real user id.
  9122. If the <B>-p</B> option is supplied at startup, the effective user id is
  9123. not reset.
  9124. Turning this option off causes the effective user
  9125. and group ids to be set to the real user and group ids.
  9126. <DT><B>-t</B>
  9127. <DD>
  9128. Exit after reading and executing one command.
  9129. <DT><B>-u</B>
  9130. <DD>
  9131. Treat unset variables and parameters other than the special
  9132. parameters &quot;@&quot; and &quot;*&quot; as an error when performing
  9133. parameter expansion. If expansion is attempted on an
  9134. unset variable or parameter, the shell prints an error message, and,
  9135. if not interactive, exits with a non-zero status.
  9136. <DT><B>-v</B>
  9137. <DD>
  9138. Print shell input lines as they are read.
  9139. <DT><B>-x</B>
  9140. <DD>
  9141. After expanding each <I>simple command</I>,
  9142. <B>for</B> command, <B>case</B> command, <B>select</B> command, or
  9143. arithmetic <B>for</B> command, display the expanded value of
  9144. <FONT SIZE=-1><B>PS4</B>,
  9145. </FONT>
  9146. followed by the command and its expanded arguments
  9147. or associated word list.
  9148. <DT><B>-B</B>
  9149. <DD>
  9150. The shell performs brace expansion (see
  9151. <B>Brace Expansion</B>
  9152. above). This is on by default.
  9153. <DT><B>-C</B>
  9154. <DD>
  9155. If set,
  9156. <B>bash</B>
  9157. does not overwrite an existing file with the
  9158. <B>&gt;</B>,
  9159. <B>&gt;&amp;</B>,
  9160. and
  9161. <B>&lt;&gt;</B>
  9162. redirection operators. This may be overridden when
  9163. creating output files by using the redirection operator
  9164. <B>&gt;|</B>
  9165. instead of
  9166. <B>&gt;</B>.
  9167. <DT><B>-E</B>
  9168. <DD>
  9169. If set, any trap on <B>ERR</B> is inherited by shell functions, command
  9170. substitutions, and commands executed in a subshell environment.
  9171. The <B>ERR</B> trap is normally not inherited in such cases.
  9172. <DT><B>-H</B>
  9173. <DD>
  9174. Enable
  9175. <B>!</B>
  9176. style history substitution. This option is on by
  9177. default when the shell is interactive.
  9178. <DT><B>-P</B>
  9179. <DD>
  9180. If set, the shell does not resolve symbolic links when executing
  9181. commands such as
  9182. <B>cd</B>
  9183. that change the current working directory. It uses the
  9184. physical directory structure instead. By default,
  9185. <B>bash</B>
  9186. follows the logical chain of directories when performing commands
  9187. which change the current directory.
  9188. <DT><B>-T</B>
  9189. <DD>
  9190. If set, any traps on <B>DEBUG</B> and <B>RETURN</B> are inherited by shell
  9191. functions, command substitutions, and commands executed in a
  9192. subshell environment.
  9193. The <B>DEBUG</B> and <B>RETURN</B> traps are normally not inherited
  9194. in such cases.
  9195. <DT><B>--</B>
  9196. <DD>
  9197. If no arguments follow this option, then the positional parameters are
  9198. unset. Otherwise, the positional parameters are set to the
  9199. <I>arg</I>s, even if some of them begin with a
  9200. <B>-</B>.
  9201. <DT><B>-</B>
  9202. <DD>
  9203. Signal the end of options, cause all remaining <I>arg</I>s to be
  9204. assigned to the positional parameters. The
  9205. <B>-x</B>
  9206. and
  9207. <B>-v</B>
  9208. options are turned off.
  9209. If there are no <I>arg</I>s,
  9210. the positional parameters remain unchanged.
  9211. </DL>
  9212. <P>
  9213. The options are off by default unless otherwise noted.
  9214. Using + rather than - causes these options to be turned off.
  9215. The options can also be specified as arguments to an invocation of
  9216. the shell.
  9217. The current set of options may be found in
  9218. <B>$-</B>.
  9219. The return status is always true unless an invalid option is encountered.
  9220. </DL>
  9221. <DT><B>shift</B> [<I>n</I>]<DD>
  9222. The positional parameters from <I>n</I>+1 ... are renamed to
  9223. <B>$1</B>
  9224. <B>....</B>
  9225. Parameters represented by the numbers <B>$#</B>
  9226. down to <B>$#</B>-<I>n</I>+1 are unset.
  9227. <I>n</I>
  9228. must be a non-negative number less than or equal to <B>$#</B>.
  9229. If
  9230. <I>n</I>
  9231. is 0, no parameters are changed.
  9232. If
  9233. <I>n</I>
  9234. is not given, it is assumed to be 1.
  9235. If
  9236. <I>n</I>
  9237. is greater than <B>$#</B>, the positional parameters are not changed.
  9238. The return status is greater than zero if
  9239. <I>n</I>
  9240. is greater than
  9241. <B>$#</B>
  9242. or less than zero; otherwise 0.
  9243. <DT><B>shopt</B> [<B>-pqsu</B>] [<B>-o</B>] [<I>optname</I> ...]<DD>
  9244. Toggle the values of settings controlling optional shell behavior.
  9245. The settings can be either those listed below, or, if the
  9246. <B>-o</B>
  9247. option is used, those available with the
  9248. <B>-o</B>
  9249. option to the <B>set</B> builtin command.
  9250. With no options, or with the
  9251. <B>-p</B>
  9252. option, a list of all settable options is displayed, with
  9253. an indication of whether or not each is set.
  9254. The <B>-p</B> option causes output to be displayed in a form that
  9255. may be reused as input.
  9256. Other options have the following meanings:
  9257. <DL COMPACT><DT><DD>
  9258. <DL COMPACT>
  9259. <DT><B>-s</B>
  9260. <DD>
  9261. Enable (set) each <I>optname</I>.
  9262. <DT><B>-u</B>
  9263. <DD>
  9264. Disable (unset) each <I>optname</I>.
  9265. <DT><B>-q</B>
  9266. <DD>
  9267. Suppresses normal output (quiet mode); the return status indicates
  9268. whether the <I>optname</I> is set or unset.
  9269. If multiple <I>optname</I> arguments are given with
  9270. <B>-q</B>,
  9271. the return status is zero if all <I>optnames</I> are enabled; non-zero
  9272. otherwise.
  9273. <DT><B>-o</B>
  9274. <DD>
  9275. Restricts the values of <I>optname</I> to be those defined for the
  9276. <B>-o</B>
  9277. option to the
  9278. <B>set</B>
  9279. builtin.
  9280. </DL>
  9281. <P>
  9282. If either
  9283. <B>-s</B>
  9284. or
  9285. <B>-u</B>
  9286. is used with no <I>optname</I> arguments,
  9287. <B>shopt</B>
  9288. shows only those options which are set or unset, respectively.
  9289. Unless otherwise noted, the <B>shopt</B> options are disabled (unset)
  9290. by default.
  9291. <P>
  9292. The return status when listing options is zero if all <I>optnames</I>
  9293. are enabled, non-zero otherwise. When setting or unsetting options,
  9294. the return status is zero unless an <I>optname</I> is not a valid shell
  9295. option.
  9296. <P>
  9297. The list of <B>shopt</B> options is:
  9298. <P>
  9299. <DL COMPACT>
  9300. <DT><B>autocd</B>
  9301. <DD>
  9302. If set, a command name that is the name of a directory is executed as if
  9303. it were the argument to the <B>cd</B> command.
  9304. This option is only used by interactive shells.
  9305. <DT><B>cdable_vars</B>
  9306. <DD>
  9307. If set, an argument to the
  9308. <B>cd</B>
  9309. builtin command that
  9310. is not a directory is assumed to be the name of a variable whose
  9311. value is the directory to change to.
  9312. <DT><B>cdspell</B>
  9313. <DD>
  9314. If set, minor errors in the spelling of a directory component in a
  9315. <B>cd</B>
  9316. command will be corrected.
  9317. The errors checked for are transposed characters,
  9318. a missing character, and one character too many.
  9319. If a correction is found, the corrected filename is printed,
  9320. and the command proceeds.
  9321. This option is only used by interactive shells.
  9322. <DT><B>checkhash</B>
  9323. <DD>
  9324. If set, <B>bash</B> checks that a command found in the hash
  9325. table exists before trying to execute it. If a hashed command no
  9326. longer exists, a normal path search is performed.
  9327. <DT><B>checkjobs</B>
  9328. <DD>
  9329. If set, <B>bash</B> lists the status of any stopped and running jobs before
  9330. exiting an interactive shell. If any jobs are running, this causes
  9331. the exit to be deferred until a second exit is attempted without an
  9332. intervening command (see
  9333. <FONT SIZE=-1><B>JOB CONTROL</B>
  9334. </FONT>
  9335. above). The shell always
  9336. postpones exiting if any jobs are stopped.
  9337. <DT><B>checkwinsize</B>
  9338. <DD>
  9339. If set, <B>bash</B> checks the window size after each command
  9340. and, if necessary, updates the values of
  9341. <FONT SIZE=-1><B>LINES</B>
  9342. </FONT>
  9343. and
  9344. <FONT SIZE=-1><B>COLUMNS</B>.
  9345. </FONT>
  9346. <DT><B>cmdhist</B>
  9347. <DD>
  9348. If set,
  9349. <B>bash</B>
  9350. attempts to save all lines of a multiple-line
  9351. command in the same history entry. This allows
  9352. easy re-editing of multi-line commands.
  9353. <DT><B>compat31</B>
  9354. <DD>
  9355. If set,
  9356. <B>bash</B>
  9357. changes its behavior to that of version 3.1 with respect to quoted
  9358. arguments to the <B>[[</B> conditional command's <B>=~</B> operator
  9359. and locale-specific string comparison when using the <B>[[</B>
  9360. conditional command's <B>&lt;</B> and <B>&gt;</B> operators.
  9361. Bash versions prior to bash-4.1 use ASCII collation and
  9362. <I>strcmp</I>(3);
  9363. bash-4.1 and later use the current locale's collation sequence and
  9364. <I>strcoll</I>(3).
  9365. <DT><B>compat32</B>
  9366. <DD>
  9367. If set,
  9368. <B>bash</B>
  9369. changes its behavior to that of version 3.2 with respect to
  9370. locale-specific string comparison when using the <B>[[</B>
  9371. conditional command's <B>&lt;</B> and <B>&gt;</B> operators (see previous item)
  9372. and the effect of interrupting a command list.
  9373. Bash versions 3.2 and earlier continue with the next command in the list
  9374. after one terminates due to an interrupt.
  9375. <DT><B>compat40</B>
  9376. <DD>
  9377. If set,
  9378. <B>bash</B>
  9379. changes its behavior to that of version 4.0 with respect to locale-specific
  9380. string comparison when using the <B>[[</B>
  9381. conditional command's <B>&lt;</B> and <B>&gt;</B> operators (see description of
  9382. <B>compat31</B>)
  9383. and the effect of interrupting a command list.
  9384. Bash versions 4.0 and later interrupt the list as if the shell received the
  9385. interrupt; previous versions continue with the next command in the list.
  9386. <DT><B>compat41</B>
  9387. <DD>
  9388. If set,
  9389. <B>bash</B>,
  9390. when in <I>posix</I> mode, treats a single quote in a double-quoted
  9391. parameter expansion as a special character. The single quotes must match
  9392. (an even number) and the characters between the single quotes are considered
  9393. quoted. This is the behavior of posix mode through version 4.1.
  9394. The default bash behavior remains as in previous versions.
  9395. <DT><B>compat42</B>
  9396. <DD>
  9397. If set,
  9398. <B>bash</B>
  9399. does not process the replacement string in the pattern substitution word
  9400. expansion using quote removal.
  9401. <DT><B>compat43</B>
  9402. <DD>
  9403. If set,
  9404. <B>bash</B>
  9405. does not print a warning message if an attempt is made to use a quoted compound
  9406. array assignment as an argument to <B>declare</B>,
  9407. makes word expansion errors
  9408. non-fatal errors that cause the current command to fail (the default behavior is
  9409. to make them fatal errors that cause the shell to exit),
  9410. and does not reset the
  9411. loop state when a shell function is executed (this allows <B>break</B> or
  9412. <B>continue</B> in a shell function to affect loops in the caller's context).
  9413. <DT><B>complete_fullquote</B>
  9414. <DD>
  9415. If set,
  9416. <B>bash</B>
  9417. quotes all shell metacharacters in filenames and directory names when
  9418. performing completion.
  9419. If not set,
  9420. <B>bash</B>
  9421. removes metacharacters such as the dollar sign from the set of
  9422. characters that will be quoted in completed filenames
  9423. when these metacharacters appear in shell variable references in words to be
  9424. completed.
  9425. This means that dollar signs in variable names that expand to directories
  9426. will not be quoted;
  9427. however, any dollar signs appearing in filenames will not be quoted, either.
  9428. This is active only when bash is using backslashes to quote completed
  9429. filenames.
  9430. This variable is set by default, which is the default bash behavior in
  9431. versions through 4.2.
  9432. <DT><B>direxpand</B>
  9433. <DD>
  9434. If set,
  9435. <B>bash</B>
  9436. replaces directory names with the results of word expansion when performing
  9437. filename completion. This changes the contents of the readline editing
  9438. buffer.
  9439. If not set,
  9440. <B>bash</B>
  9441. attempts to preserve what the user typed.
  9442. <DT><B>dirspell</B>
  9443. <DD>
  9444. If set,
  9445. <B>bash</B>
  9446. attempts spelling correction on directory names during word completion
  9447. if the directory name initially supplied does not exist.
  9448. <DT><B>dotglob</B>
  9449. <DD>
  9450. If set,
  9451. <B>bash</B>
  9452. includes filenames beginning with a `.' in the results of pathname
  9453. expansion.
  9454. <DT><B>execfail</B>
  9455. <DD>
  9456. If set, a non-interactive shell will not exit if
  9457. it cannot execute the file specified as an argument to the
  9458. <B>exec</B>
  9459. builtin command. An interactive shell does not exit if
  9460. <B>exec</B>
  9461. fails.
  9462. <DT><B>expand_aliases</B>
  9463. <DD>
  9464. If set, aliases are expanded as described above under
  9465. <FONT SIZE=-1><B>ALIASES</B>.
  9466. </FONT>
  9467. This option is enabled by default for interactive shells.
  9468. <DT><B>extdebug</B>
  9469. <DD>
  9470. If set at shell invocation, arrange to execute the debugger profile
  9471. before the shell starts, identical to the <B>--debugger</B> option.
  9472. If set after invocation, behavior intended for use by debuggers is enabled:
  9473. <DL COMPACT><DT><DD>
  9474. <DL COMPACT>
  9475. <DT><B>1.</B>
  9476. <DD>
  9477. The <B>-F</B> option to the <B>declare</B> builtin displays the source
  9478. file name and line number corresponding to each function name supplied
  9479. as an argument.
  9480. <DT><B>2.</B>
  9481. <DD>
  9482. If the command run by the <B>DEBUG</B> trap returns a non-zero value, the
  9483. next command is skipped and not executed.
  9484. <DT><B>3.</B>
  9485. <DD>
  9486. If the command run by the <B>DEBUG</B> trap returns a value of 2, and the
  9487. shell is executing in a subroutine (a shell function or a shell script
  9488. executed by the <B>.</B> or <B>source</B> builtins), the shell simulates
  9489. a call to <B>return</B>.
  9490. <DT><B>4.</B>
  9491. <DD>
  9492. <FONT SIZE=-1><B>BASH_ARGC</B>
  9493. </FONT>
  9494. and
  9495. <FONT SIZE=-1><B>BASH_ARGV</B>
  9496. </FONT>
  9497. are updated as described in their descriptions above.
  9498. <DT><B>5.</B>
  9499. <DD>
  9500. Function tracing is enabled: command substitution, shell functions, and
  9501. subshells invoked with <B>(</B> <I>command</I> <B>)</B> inherit the
  9502. <B>DEBUG</B> and <B>RETURN</B> traps.
  9503. <DT><B>6.</B>
  9504. <DD>
  9505. Error tracing is enabled: command substitution, shell functions, and
  9506. subshells invoked with <B>(</B> <I>command</I> <B>)</B> inherit the
  9507. <B>ERR</B> trap.
  9508. </DL></DL>
  9509. <DT><B>extglob</B>
  9510. <DD>
  9511. If set, the extended pattern matching features described above under
  9512. <B>Pathname Expansion</B> are enabled.
  9513. <DT><B>extquote</B>
  9514. <DD>
  9515. If set, <B>$</B>aq<I>string</I>aq and <B>$</B>&quot;<I>string</I>&quot; quoting is
  9516. performed within <B>${</B><I>parameter</I><B>}</B> expansions
  9517. enclosed in double quotes. This option is enabled by default.
  9518. <DT><B>failglob</B>
  9519. <DD>
  9520. If set, patterns which fail to match filenames during pathname expansion
  9521. result in an expansion error.
  9522. <DT><B>force_fignore</B>
  9523. <DD>
  9524. If set, the suffixes specified by the
  9525. <FONT SIZE=-1><B>FIGNORE</B>
  9526. </FONT>
  9527. shell variable
  9528. cause words to be ignored when performing word completion even if
  9529. the ignored words are the only possible completions.
  9530. See
  9531. <FONT SIZE=-1><B>SHELL VARIABLES</B></FONT>
  9532. above for a description of
  9533. <FONT SIZE=-1><B>FIGNORE</B>.
  9534. </FONT>
  9535. This option is enabled by default.
  9536. <DT><B>globasciiranges</B>
  9537. <DD>
  9538. If set, range expressions used in pattern matching bracket expressions (see
  9539. <FONT SIZE=-1><B>Pattern Matching</B>
  9540. </FONT>
  9541. above) behave as if in the traditional C locale when performing
  9542. comparisons. That is, the current locale's collating sequence
  9543. is not taken into account, so
  9544. <B>b</B>
  9545. will not collate between
  9546. <B>A</B>
  9547. and
  9548. <B>B</B>,
  9549. and upper-case and lower-case ASCII characters will collate together.
  9550. <DT><B>globstar</B>
  9551. <DD>
  9552. If set, the pattern <B>**</B> used in a pathname expansion context will
  9553. match all files and zero or more directories and subdirectories.
  9554. If the pattern is followed by a <B>/</B>, only directories and
  9555. subdirectories match.
  9556. <DT><B>gnu_errfmt</B>
  9557. <DD>
  9558. If set, shell error messages are written in the standard GNU error
  9559. message format.
  9560. <DT><B>histappend</B>
  9561. <DD>
  9562. If set, the history list is appended to the file named by the value
  9563. of the
  9564. <FONT SIZE=-1><B>HISTFILE</B>
  9565. </FONT>
  9566. variable when the shell exits, rather than overwriting the file.
  9567. <DT><B>histreedit</B>
  9568. <DD>
  9569. If set, and
  9570. <B>readline</B>
  9571. is being used, a user is given the opportunity to re-edit a
  9572. failed history substitution.
  9573. <DT><B>histverify</B>
  9574. <DD>
  9575. If set, and
  9576. <B>readline</B>
  9577. is being used, the results of history substitution are not immediately
  9578. passed to the shell parser. Instead, the resulting line is loaded into
  9579. the <B>readline</B> editing buffer, allowing further modification.
  9580. <DT><B>hostcomplete</B>
  9581. <DD>
  9582. If set, and
  9583. <B>readline</B>
  9584. is being used, <B>bash</B> will attempt to perform hostname completion when a
  9585. word containing a <B>@</B> is being completed (see
  9586. <B>Completing</B>
  9587. under
  9588. <FONT SIZE=-1><B>READLINE</B>
  9589. </FONT>
  9590. above).
  9591. This is enabled by default.
  9592. <DT><B>huponexit</B>
  9593. <DD>
  9594. If set, <B>bash</B> will send
  9595. <FONT SIZE=-1><B>SIGHUP</B>
  9596. </FONT>
  9597. to all jobs when an interactive login shell exits.
  9598. <DT><B>inherit_errexit</B>
  9599. <DD>
  9600. If set, command substitution inherits the value of the <B>errexit</B> option,
  9601. instead of unsetting it in the subshell environment.
  9602. This option is enabled when <I>posix mode</I> is enabled.
  9603. <DT><B>interactive_comments</B>
  9604. <DD>
  9605. If set, allow a word beginning with
  9606. <B>#</B>
  9607. to cause that word and all remaining characters on that
  9608. line to be ignored in an interactive shell (see
  9609. <FONT SIZE=-1><B>COMMENTS</B>
  9610. </FONT>
  9611. above). This option is enabled by default.
  9612. <DT><B>lastpipe</B>
  9613. <DD>
  9614. If set, and job control is not active, the shell runs the last command of
  9615. a pipeline not executed in the background in the current shell environment.
  9616. <DT><B>lithist</B>
  9617. <DD>
  9618. If set, and the
  9619. <B>cmdhist</B>
  9620. option is enabled, multi-line commands are saved to the history with
  9621. embedded newlines rather than using semicolon separators where possible.
  9622. <DT><B>login_shell</B>
  9623. <DD>
  9624. The shell sets this option if it is started as a login shell (see
  9625. <FONT SIZE=-1><B>INVOCATION</B>
  9626. </FONT>
  9627. above).
  9628. The value may not be changed.
  9629. <DT><B>mailwarn</B>
  9630. <DD>
  9631. If set, and a file that <B>bash</B> is checking for mail has been
  9632. accessed since the last time it was checked, the message ``The mail in
  9633. <I>mailfile</I> has been read'' is displayed.
  9634. <DT><B>no_empty_cmd_completion</B>
  9635. <DD>
  9636. If set, and
  9637. <B>readline</B>
  9638. is being used,
  9639. <B>bash</B>
  9640. will not attempt to search the
  9641. <FONT SIZE=-1><B>PATH</B>
  9642. </FONT>
  9643. for possible completions when
  9644. completion is attempted on an empty line.
  9645. <DT><B>nocaseglob</B>
  9646. <DD>
  9647. If set,
  9648. <B>bash</B>
  9649. matches filenames in a case-insensitive fashion when performing pathname
  9650. expansion (see
  9651. <B>Pathname Expansion</B>
  9652. above).
  9653. <DT><B>nocasematch</B>
  9654. <DD>
  9655. If set,
  9656. <B>bash</B>
  9657. matches patterns in a case-insensitive fashion when performing matching
  9658. while executing <B>case</B> or <B>[[</B> conditional commands,
  9659. when performing pattern substitution word expansions,
  9660. or when filtering possible completions as part of programmable completion.
  9661. <DT><B>nullglob</B>
  9662. <DD>
  9663. If set,
  9664. <B>bash</B>
  9665. allows patterns which match no
  9666. files (see
  9667. <B>Pathname Expansion</B>
  9668. above)
  9669. to expand to a null string, rather than themselves.
  9670. <DT><B>progcomp</B>
  9671. <DD>
  9672. If set, the programmable completion facilities (see
  9673. <B>Programmable Completion</B> above) are enabled.
  9674. This option is enabled by default.
  9675. <DT><B>promptvars</B>
  9676. <DD>
  9677. If set, prompt strings undergo
  9678. parameter expansion, command substitution, arithmetic
  9679. expansion, and quote removal after being expanded as described in
  9680. <FONT SIZE=-1><B>PROMPTING</B>
  9681. </FONT>
  9682. above. This option is enabled by default.
  9683. <DT><B>restricted_shell</B>
  9684. <DD>
  9685. The shell sets this option if it is started in restricted mode (see
  9686. <FONT SIZE=-1><B>RESTRICTED SHELL</B>
  9687. </FONT>
  9688. below).
  9689. The value may not be changed.
  9690. This is not reset when the startup files are executed, allowing
  9691. the startup files to discover whether or not a shell is restricted.
  9692. <DT><B>shift_verbose</B>
  9693. <DD>
  9694. If set, the
  9695. <B>shift</B>
  9696. builtin prints an error message when the shift count exceeds the
  9697. number of positional parameters.
  9698. <DT><B>sourcepath</B>
  9699. <DD>
  9700. If set, the
  9701. <B>source</B> (<B>.</B>) builtin uses the value of
  9702. <FONT SIZE=-1><B>PATH</B>
  9703. </FONT>
  9704. to find the directory containing the file supplied as an argument.
  9705. This option is enabled by default.
  9706. <DT><B>xpg_echo</B>
  9707. <DD>
  9708. If set, the <B>echo</B> builtin expands backslash-escape sequences
  9709. by default.
  9710. </DL></DL>
  9711. <DT><B>suspend</B> [<B>-f</B>]<DD>
  9712. Suspend the execution of this shell until it receives a
  9713. <FONT SIZE=-1><B>SIGCONT</B>
  9714. </FONT>
  9715. signal. A login shell cannot be suspended; the
  9716. <B>-f</B>
  9717. option can be used to override this and force the suspension.
  9718. The return status is 0 unless the shell is a login shell and
  9719. <B>-f</B>
  9720. is not supplied, or if job control is not enabled.
  9721. <DT><B>test</B> <I>expr</I><DD>
  9722. <DT><B>[</B> <I>expr</I> <B>]</B><DD>
  9723. Return a status of 0 (true) or 1 (false) depending on
  9724. the evaluation of the conditional expression
  9725. <I>expr</I>.
  9726. Each operator and operand must be a separate argument.
  9727. Expressions are composed of the primaries described above under
  9728. <FONT SIZE=-1><B>CONDITIONAL EXPRESSIONS</B>.
  9729. </FONT>
  9730. <B>test</B> does not accept any options, nor does it accept and ignore
  9731. an argument of <B>--</B> as signifying the end of options.
  9732. <P>
  9733. Expressions may be combined using the following operators, listed
  9734. in decreasing order of precedence.
  9735. The evaluation depends on the number of arguments; see below.
  9736. Operator precedence is used when there are five or more arguments.
  9737. <DL COMPACT><DT><DD>
  9738. <DL COMPACT>
  9739. <DT><B>! </B><I>expr</I>
  9740. <DD>
  9741. True if
  9742. <I>expr</I>
  9743. is false.
  9744. <DT><B>( </B><I>expr</I> )
  9745. <DD>
  9746. Returns the value of <I>expr</I>.
  9747. This may be used to override the normal precedence of operators.
  9748. <DT><I>expr1</I> -<B>a</B> <I>expr2</I><DD>
  9749. True if both
  9750. <I>expr1</I>
  9751. and
  9752. <I>expr2</I>
  9753. are true.
  9754. <DT><I>expr1</I> -<B>o</B> <I>expr2</I><DD>
  9755. True if either
  9756. <I>expr1</I>
  9757. or
  9758. <I>expr2</I>
  9759. is true.
  9760. </DL>
  9761. <P>
  9762. <B>test</B> and <B>[</B> evaluate conditional
  9763. expressions using a set of rules based on the number of arguments.
  9764. <P>
  9765. <DL COMPACT>
  9766. <DT>0 arguments<DD>
  9767. The expression is false.
  9768. <DT>1 argument<DD>
  9769. The expression is true if and only if the argument is not null.
  9770. <DT>2 arguments<DD>
  9771. If the first argument is <B>!</B>, the expression is true if and
  9772. only if the second argument is null.
  9773. If the first argument is one of the unary conditional operators listed above
  9774. under
  9775. <FONT SIZE=-1><B>CONDITIONAL EXPRESSIONS</B>,
  9776. </FONT>
  9777. the expression is true if the unary test is true.
  9778. If the first argument is not a valid unary conditional operator, the expression
  9779. is false.
  9780. <DT>3 arguments<DD>
  9781. The following conditions are applied in the order listed.
  9782. If the second argument is one of the binary conditional operators listed above
  9783. under
  9784. <FONT SIZE=-1><B>CONDITIONAL EXPRESSIONS</B>,
  9785. </FONT>
  9786. the result of the expression is the result of the binary test using
  9787. the first and third arguments as operands.
  9788. The <B>-a</B> and <B>-o</B> operators are considered binary operators
  9789. when there are three arguments.
  9790. If the first argument is <B>!</B>, the value is the negation of
  9791. the two-argument test using the second and third arguments.
  9792. If the first argument is exactly <B>(</B> and the third argument is
  9793. exactly <B>)</B>, the result is the one-argument test of the second
  9794. argument.
  9795. Otherwise, the expression is false.
  9796. <DT>4 arguments<DD>
  9797. If the first argument is <B>!</B>, the result is the negation of
  9798. the three-argument expression composed of the remaining arguments.
  9799. Otherwise, the expression is parsed and evaluated according to
  9800. precedence using the rules listed above.
  9801. <DT>5 or more arguments<DD>
  9802. The expression is parsed and evaluated according to precedence
  9803. using the rules listed above.
  9804. <P>
  9805. </DL>
  9806. <P>
  9807. When used with <B>test</B> or <B>[</B>, the <B>&lt;</B> and <B>&gt;</B> operators
  9808. sort lexicographically using ASCII ordering.
  9809. </DL>
  9810. <DT><B>times</B>
  9811. <DD>
  9812. Print the accumulated user and system times for the shell and
  9813. for processes run from the shell. The return status is 0.
  9814. <DT><B>trap</B> [<B>-lp</B>] [[<I>arg</I>] <I>sigspec</I> ...]<DD>
  9815. The command
  9816. <I>arg</I>
  9817. is to be read and executed when the shell receives
  9818. signal(s)
  9819. <I>sigspec</I>.
  9820. If
  9821. <I>arg</I>
  9822. is absent (and there is a single <I>sigspec</I>) or
  9823. <B>-</B>,
  9824. each specified signal is
  9825. reset to its original disposition (the value it had
  9826. upon entrance to the shell).
  9827. If
  9828. <I>arg</I>
  9829. is the null string the signal specified by each
  9830. <I>sigspec</I>
  9831. is ignored by the shell and by the commands it invokes.
  9832. If
  9833. <I>arg</I>
  9834. is not present and
  9835. <B>-p</B>
  9836. has been supplied, then the trap commands associated with each
  9837. <I>sigspec</I>
  9838. are displayed.
  9839. If no arguments are supplied or if only
  9840. <B>-p</B>
  9841. is given,
  9842. <B>trap</B>
  9843. prints the list of commands associated with each signal.
  9844. The
  9845. <B>-l</B>
  9846. option causes the shell to print a list of signal names and
  9847. their corresponding numbers.
  9848. Each
  9849. <I>sigspec</I>
  9850. is either
  9851. a signal name defined in &lt;<I>signal.h</I>&gt;, or a signal number.
  9852. Signal names are case insensitive and the
  9853. <FONT SIZE=-1><B>SIG</B>
  9854. </FONT>
  9855. prefix is optional.
  9856. <P>
  9857. If a
  9858. <I>sigspec</I>
  9859. is
  9860. <FONT SIZE=-1><B>EXIT</B>
  9861. </FONT>
  9862. (0) the command
  9863. <I>arg</I>
  9864. is executed on exit from the shell.
  9865. If a
  9866. <I>sigspec</I>
  9867. is
  9868. <FONT SIZE=-1><B>DEBUG</B>,
  9869. </FONT>
  9870. the command
  9871. <I>arg</I>
  9872. is executed before every <I>simple command</I>, <I>for</I> command,
  9873. <I>case</I> command, <I>select</I> command, every arithmetic <I>for</I>
  9874. command, and before the first command executes in a shell function (see
  9875. <FONT SIZE=-1><B>SHELL GRAMMAR</B>
  9876. </FONT>
  9877. above).
  9878. Refer to the description of the <B>extdebug</B> option to the
  9879. <B>shopt</B> builtin for details of its effect on the <B>DEBUG</B> trap.
  9880. If a
  9881. <I>sigspec</I>
  9882. is
  9883. <FONT SIZE=-1><B>RETURN</B>,
  9884. </FONT>
  9885. the command
  9886. <I>arg</I>
  9887. is executed each time a shell function or a script executed with
  9888. the <B>.</B> or <B>source</B> builtins finishes executing.
  9889. <P>
  9890. If a
  9891. <I>sigspec</I>
  9892. is
  9893. <FONT SIZE=-1><B>ERR</B>,
  9894. </FONT>
  9895. the command
  9896. <I>arg</I>
  9897. is executed whenever
  9898. a pipeline (which may consist of a single simple
  9899. command), a list, or a compound command returns a
  9900. non-zero exit status,
  9901. subject to the following conditions.
  9902. The
  9903. <FONT SIZE=-1><B>ERR</B>
  9904. </FONT>
  9905. trap is not executed if the failed
  9906. command is part of the command list immediately following a
  9907. <B>while</B>
  9908. or
  9909. <B>until</B>
  9910. keyword,
  9911. part of the test in an
  9912. <I>if</I>
  9913. statement, part of a command executed in a
  9914. <B>&amp;&amp;</B>
  9915. or
  9916. <B>||</B>
  9917. list except the command following the final <B>&amp;&amp;</B> or <B>||</B>,
  9918. any command in a pipeline but the last,
  9919. or if the command's return value is
  9920. being inverted using
  9921. <B>!</B>.
  9922. These are the same conditions obeyed by the <B>errexit</B> (<B>-e</B>) option.
  9923. <P>
  9924. Signals ignored upon entry to the shell cannot be trapped or reset.
  9925. Trapped signals that are not being ignored are reset to their original
  9926. values in a subshell or subshell environment when one is created.
  9927. The return status is false if any
  9928. <I>sigspec</I>
  9929. is invalid; otherwise
  9930. <B>trap</B>
  9931. returns true.
  9932. <DT><B>type</B> [<B>-aftpP</B>] <I>name</I> [<I>name</I> ...]<DD>
  9933. With no options,
  9934. indicate how each
  9935. <I>name</I>
  9936. would be interpreted if used as a command name.
  9937. If the
  9938. <B>-t</B>
  9939. option is used,
  9940. <B>type</B>
  9941. prints a string which is one of
  9942. <I>alias</I>,
  9943. <I>keyword</I>,
  9944. <I>function</I>,
  9945. <I>builtin</I>,
  9946. or
  9947. <I>file</I>
  9948. if
  9949. <I>name</I>
  9950. is an alias, shell reserved word, function, builtin, or disk file,
  9951. respectively.
  9952. If the
  9953. <I>name</I>
  9954. is not found, then nothing is printed, and an exit status of false
  9955. is returned.
  9956. If the
  9957. <B>-p</B>
  9958. option is used,
  9959. <B>type</B>
  9960. either returns the name of the disk file
  9961. that would be executed if
  9962. <I>name</I>
  9963. were specified as a command name,
  9964. or nothing if
  9965. <TT>type -t name</TT>
  9966. would not return
  9967. <I>file</I>.
  9968. The
  9969. <B>-P</B>
  9970. option forces a
  9971. <FONT SIZE=-1><B>PATH</B>
  9972. </FONT>
  9973. search for each <I>name</I>, even if
  9974. <TT>type -t name</TT>
  9975. would not return
  9976. <I>file</I>.
  9977. If a command is hashed,
  9978. <B>-p</B>
  9979. and
  9980. <B>-P</B>
  9981. print the hashed value, which is not necessarily the file that appears
  9982. first in
  9983. <FONT SIZE=-1><B>PATH</B>.
  9984. </FONT>
  9985. If the
  9986. <B>-a</B>
  9987. option is used,
  9988. <B>type</B>
  9989. prints all of the places that contain
  9990. an executable named
  9991. <I>name</I>.
  9992. This includes aliases and functions,
  9993. if and only if the
  9994. <B>-p</B>
  9995. option is not also used.
  9996. The table of hashed commands is not consulted
  9997. when using
  9998. <B>-a</B>.
  9999. The
  10000. <B>-f</B>
  10001. option suppresses shell function lookup, as with the <B>command</B> builtin.
  10002. <B>type</B>
  10003. returns true if all of the arguments are found, false if
  10004. any are not found.
  10005. <DT><B>ulimit</B> [<B>-HSabcdefiklmnpqrstuvxPT</B> [<I>limit</I>]]<DD>
  10006. Provides control over the resources available to the shell and to
  10007. processes started by it, on systems that allow such control.
  10008. The <B>-H</B> and <B>-S</B> options specify that the hard or soft limit is
  10009. set for the given resource.
  10010. A hard limit cannot be increased by a non-root user once it is set;
  10011. a soft limit may be increased up to the value of the hard limit.
  10012. If neither <B>-H</B> nor <B>-S</B> is specified, both the soft and hard
  10013. limits are set.
  10014. The value of
  10015. <I>limit</I>
  10016. can be a number in the unit specified for the resource
  10017. or one of the special values
  10018. <B>hard</B>,
  10019. <B>soft</B>,
  10020. or
  10021. <B>unlimited</B>,
  10022. which stand for the current hard limit, the current soft limit, and
  10023. no limit, respectively.
  10024. If
  10025. <I>limit</I>
  10026. is omitted, the current value of the soft limit of the resource is
  10027. printed, unless the <B>-H</B> option is given. When more than one
  10028. resource is specified, the limit name and unit are printed before the value.
  10029. Other options are interpreted as follows:
  10030. <DL COMPACT><DT><DD>
  10031. <DL COMPACT>
  10032. <DT><B>-a</B>
  10033. <DD>
  10034. All current limits are reported
  10035. <DT><B>-b</B>
  10036. <DD>
  10037. The maximum socket buffer size
  10038. <DT><B>-c</B>
  10039. <DD>
  10040. The maximum size of core files created
  10041. <DT><B>-d</B>
  10042. <DD>
  10043. The maximum size of a process's data segment
  10044. <DT><B>-e</B>
  10045. <DD>
  10046. The maximum scheduling priority (&quot;nice&quot;)
  10047. <DT><B>-f</B>
  10048. <DD>
  10049. The maximum size of files written by the shell and its children
  10050. <DT><B>-i</B>
  10051. <DD>
  10052. The maximum number of pending signals
  10053. <DT><B>-k</B>
  10054. <DD>
  10055. The maximum number of kqueues that may be allocated
  10056. <DT><B>-l</B>
  10057. <DD>
  10058. The maximum size that may be locked into memory
  10059. <DT><B>-m</B>
  10060. <DD>
  10061. The maximum resident set size (many systems do not honor this limit)
  10062. <DT><B>-n</B>
  10063. <DD>
  10064. The maximum number of open file descriptors (most systems do not
  10065. allow this value to be set)
  10066. <DT><B>-p</B>
  10067. <DD>
  10068. The pipe size in 512-byte blocks (this may not be set)
  10069. <DT><B>-q</B>
  10070. <DD>
  10071. The maximum number of bytes in POSIX message queues
  10072. <DT><B>-r</B>
  10073. <DD>
  10074. The maximum real-time scheduling priority
  10075. <DT><B>-s</B>
  10076. <DD>
  10077. The maximum stack size
  10078. <DT><B>-t</B>
  10079. <DD>
  10080. The maximum amount of cpu time in seconds
  10081. <DT><B>-u</B>
  10082. <DD>
  10083. The maximum number of processes available to a single user
  10084. <DT><B>-v</B>
  10085. <DD>
  10086. The maximum amount of virtual memory available to the shell and, on
  10087. some systems, to its children
  10088. <DT><B>-x</B>
  10089. <DD>
  10090. The maximum number of file locks
  10091. <DT><B>-P</B>
  10092. <DD>
  10093. The maximum number of pseudoterminals
  10094. <DT><B>-T</B>
  10095. <DD>
  10096. The maximum number of threads
  10097. </DL>
  10098. <P>
  10099. If
  10100. <I>limit</I>
  10101. is given, and the
  10102. <B>-a</B>
  10103. option is not used,
  10104. <I>limit</I> is the new value of the specified resource.
  10105. If no option is given, then
  10106. <B>-f</B>
  10107. is assumed. Values are in 1024-byte increments, except for
  10108. <B>-t</B>,
  10109. which is in seconds;
  10110. <B>-p</B>,
  10111. which is in units of 512-byte blocks;
  10112. <B>-P</B>,
  10113. <B>-T</B>,
  10114. <B>-b</B>,
  10115. <B>-k</B>,
  10116. <B>-n</B>,
  10117. and
  10118. <B>-u</B>,
  10119. which are unscaled values;
  10120. and, when in Posix mode,
  10121. <B>-c</B>
  10122. and
  10123. <B>-f</B>,
  10124. which are in 512-byte increments.
  10125. The return status is 0 unless an invalid option or argument is supplied,
  10126. or an error occurs while setting a new limit.
  10127. </DL>
  10128. <DT><B>umask</B> [<B>-p</B>] [<B>-S</B>] [<I>mode</I>]<DD>
  10129. The user file-creation mask is set to
  10130. <I>mode</I>.
  10131. If
  10132. <I>mode</I>
  10133. begins with a digit, it
  10134. is interpreted as an octal number; otherwise
  10135. it is interpreted as a symbolic mode mask similar
  10136. to that accepted by
  10137. <I>chmod</I>(1).
  10138. If
  10139. <I>mode</I>
  10140. is omitted, the current value of the mask is printed.
  10141. The
  10142. <B>-S</B>
  10143. option causes the mask to be printed in symbolic form; the
  10144. default output is an octal number.
  10145. If the
  10146. <B>-p</B>
  10147. option is supplied, and
  10148. <I>mode</I>
  10149. is omitted, the output is in a form that may be reused as input.
  10150. The return status is 0 if the mode was successfully changed or if
  10151. no <I>mode</I> argument was supplied, and false otherwise.
  10152. <DT><B>unalias</B> [-<B>a</B>] [<I>name</I> ...]<DD>
  10153. Remove each <I>name</I> from the list of defined aliases. If
  10154. <B>-a</B>
  10155. is supplied, all alias definitions are removed. The return
  10156. value is true unless a supplied
  10157. <I>name</I>
  10158. is not a defined alias.
  10159. <DT><B>unset</B> [-<B>fv</B>] [-<B>n</B>] [<I>name</I> ...]<DD>
  10160. For each
  10161. <I>name</I>,
  10162. remove the corresponding variable or function.
  10163. If the
  10164. <B>-v</B>
  10165. option is given, each
  10166. <I>name</I>
  10167. refers to a shell variable, and that variable is removed.
  10168. Read-only variables may not be unset.
  10169. If
  10170. <B>-f</B>
  10171. is specified, each
  10172. <I>name</I>
  10173. refers to a shell function, and the function definition
  10174. is removed.
  10175. If the
  10176. <B>-n</B>
  10177. option is supplied, and <I>name</I> is a variable with the <I>nameref</I>
  10178. attribute, <I>name</I> will be unset rather than the variable it
  10179. references.
  10180. <B>-n</B> has no effect if the <B>-f</B> option is supplied.
  10181. If no options are supplied, each <I>name</I> refers to a variable; if
  10182. there is no variable by that name, any function with that name is
  10183. unset.
  10184. Each unset variable or function is removed from the environment
  10185. passed to subsequent commands.
  10186. If any of
  10187. <FONT SIZE=-1><B>COMP_WORDBREAKS</B>,
  10188. </FONT>
  10189. <FONT SIZE=-1><B>RANDOM</B>,
  10190. </FONT>
  10191. <FONT SIZE=-1><B>SECONDS</B>,
  10192. </FONT>
  10193. <FONT SIZE=-1><B>LINENO</B>,
  10194. </FONT>
  10195. <FONT SIZE=-1><B>HISTCMD</B>,
  10196. </FONT>
  10197. <FONT SIZE=-1><B>FUNCNAME</B>,
  10198. </FONT>
  10199. <FONT SIZE=-1><B>GROUPS</B>,
  10200. </FONT>
  10201. or
  10202. <FONT SIZE=-1><B>DIRSTACK</B>
  10203. </FONT>
  10204. are unset, they lose their special properties, even if they are
  10205. subsequently reset. The exit status is true unless a
  10206. <I>name</I>
  10207. is readonly.
  10208. <DT><B>wait</B> [<B>-n</B>] [<I>n ...</I>]<DD>
  10209. Wait for each specified child process and return its termination status.
  10210. Each
  10211. <I>n</I>
  10212. may be a process
  10213. ID or a job specification; if a job spec is given, all processes
  10214. in that job's pipeline are waited for. If
  10215. <I>n</I>
  10216. is not given, all currently active child processes
  10217. are waited for, and the return status is zero.
  10218. If the <B>-n</B> option is supplied, <B>wait</B> waits for any job to
  10219. terminate and returns its exit status.
  10220. If
  10221. <I>n</I>
  10222. specifies a non-existent process or job, the return status is
  10223. 127. Otherwise, the return status is the exit status of the last
  10224. process or job waited for.
  10225. </DL>
  10226. <A NAME="lbDC">&nbsp;</A>
  10227. <H3>RESTRICTED SHELL</H3>
  10228. <P>
  10229. If
  10230. <B>bash</B>
  10231. is started with the name
  10232. <B>rbash</B>,
  10233. or the
  10234. <B>-r</B>
  10235. option is supplied at invocation,
  10236. the shell becomes restricted.
  10237. A restricted shell is used to
  10238. set up an environment more controlled than the standard shell.
  10239. It behaves identically to
  10240. <B>bash</B>
  10241. with the exception that the following are disallowed or not performed:
  10242. <DL COMPACT>
  10243. <DT>*<DD>
  10244. changing directories with <B>cd</B>
  10245. <DT>*<DD>
  10246. setting or unsetting the values of
  10247. <FONT SIZE=-1><B>SHELL</B>,
  10248. </FONT>
  10249. <FONT SIZE=-1><B>PATH</B>,
  10250. </FONT>
  10251. <FONT SIZE=-1><B>ENV</B>,
  10252. </FONT>
  10253. or
  10254. <FONT SIZE=-1><B>BASH_ENV</B>
  10255. </FONT>
  10256. <DT>*<DD>
  10257. specifying command names containing
  10258. <B>/</B>
  10259. <DT>*<DD>
  10260. specifying a filename containing a
  10261. <B>/</B>
  10262. as an argument to the
  10263. <B>.</B>
  10264. builtin command
  10265. <DT>*<DD>
  10266. specifying a filename containing a slash as an argument to the
  10267. <B>-p</B>
  10268. option to the
  10269. <B>hash</B>
  10270. builtin command
  10271. <DT>*<DD>
  10272. importing function definitions from the shell environment at startup
  10273. <DT>*<DD>
  10274. parsing the value of
  10275. <FONT SIZE=-1><B>SHELLOPTS</B>
  10276. </FONT>
  10277. from the shell environment at startup
  10278. <DT>*<DD>
  10279. redirecting output using the &gt;, &gt;|, &lt;&gt;, &gt;&amp;, &amp;&gt;, and &gt;&gt; redirection operators
  10280. <DT>*<DD>
  10281. using the
  10282. <B>exec</B>
  10283. builtin command to replace the shell with another command
  10284. <DT>*<DD>
  10285. adding or deleting builtin commands with the
  10286. <B>-f</B>
  10287. and
  10288. <B>-d</B>
  10289. options to the
  10290. <B>enable</B>
  10291. builtin command
  10292. <DT>*<DD>
  10293. using the <B>enable</B> builtin command to enable disabled shell builtins
  10294. <DT>*<DD>
  10295. specifying the
  10296. <B>-p</B>
  10297. option to the
  10298. <B>command</B>
  10299. builtin command
  10300. <DT>*<DD>
  10301. turning off restricted mode with
  10302. <B>set +r</B> or <B>set +o restricted</B>.
  10303. </DL>
  10304. <P>
  10305. These restrictions are enforced after any startup files are read.
  10306. <P>
  10307. When a command that is found to be a shell script is executed
  10308. (see
  10309. <FONT SIZE=-1><B>COMMAND EXECUTION</B>
  10310. </FONT>
  10311. above),
  10312. <B>rbash</B>
  10313. turns off any restrictions in the shell spawned to execute the
  10314. script.
  10315. <A NAME="lbDD">&nbsp;</A>
  10316. <H3>SEE ALSO</H3>
  10317. <DL COMPACT>
  10318. <DT><I>Bash Reference Manual</I>, Brian Fox and Chet Ramey<DD>
  10319. <DT><I>The Gnu Readline Library</I>, Brian Fox and Chet Ramey<DD>
  10320. <DT><I>The Gnu History Library</I>, Brian Fox and Chet Ramey<DD>
  10321. <DT><I>Portable Operating System Interface (POSIX) Part 2: Shell and Utilities</I>, IEEE --<DD>
  10322. <A HREF="http://pubs.opengroup.org/onlinepubs/9699919799/">http://pubs.opengroup.org/onlinepubs/9699919799/</A>
  10323. <DT><A HREF="http://tiswww.case.edu/~chet/bash/POSIX">http://tiswww.case.edu/~chet/bash/POSIX</A> -- a description of posix mode<DD>
  10324. <DT><I>sh</I>(1), <I>ksh</I>(1), <I>csh</I>(1)<DD>
  10325. <DT><I>emacs</I>(1), <I>vi</I>(1)<DD>
  10326. <DT><I>readline</I>(3)<DD>
  10327. </DL>
  10328. <A NAME="lbDE">&nbsp;</A>
  10329. <H3>FILES</H3>
  10330. <DL COMPACT>
  10331. <DT>
  10332. <A HREF="file:/bin/bash"><I>/bin/bash</I></A>
  10333. <DD>
  10334. The <B>bash</B> executable
  10335. <DT>
  10336. <A HREF="file:/etc/profile"><I>/etc/profile</I></A>
  10337. <DD>
  10338. The systemwide initialization file, executed for login shells
  10339. <DT>
  10340. <A HREF="file:~/.bash_profile"><I>~/.bash_profile</I></A>
  10341. <DD>
  10342. The personal initialization file, executed for login shells
  10343. <DT>
  10344. <A HREF="file:~/.bashrc"><I>~/.bashrc</I></A>
  10345. <DD>
  10346. The individual per-interactive-shell startup file
  10347. <DT>
  10348. <A HREF="file:~/.bash_logout"><I>~/.bash_logout</I></A>
  10349. <DD>
  10350. The individual login shell cleanup file, executed when a login shell exits
  10351. <DT>
  10352. <A HREF="file:~/.inputrc"><I>~/.inputrc</I></A>
  10353. <DD>
  10354. Individual <I>readline</I> initialization file
  10355. </DL>
  10356. <A NAME="lbDF">&nbsp;</A>
  10357. <H3>AUTHORS</H3>
  10358. Brian Fox, Free Software Foundation
  10359. <BR>
  10360. <A HREF="mailto:bfox@gnu.org">bfox@gnu.org</A>
  10361. <P>
  10362. Chet Ramey, Case Western Reserve University
  10363. <BR>
  10364. <A HREF="mailto:chet.ramey@case.edu">chet.ramey@case.edu</A>
  10365. <A NAME="lbDG">&nbsp;</A>
  10366. <H3>BUG REPORTS</H3>
  10367. If you find a bug in
  10368. <B>bash,</B>
  10369. you should report it. But first, you should
  10370. make sure that it really is a bug, and that it appears in the latest
  10371. version of
  10372. <B>bash</B>.
  10373. The latest version is always available from
  10374. <I><A HREF="ftp://ftp.gnu.org/pub/gnu/bash/">ftp://ftp.gnu.org/pub/gnu/bash/</A></I>.
  10375. <P>
  10376. Once you have determined that a bug actually exists, use the
  10377. <I>bashbug</I>
  10378. command to submit a bug report.
  10379. If you have a fix, you are encouraged to mail that as well!
  10380. Suggestions and `philosophical' bug reports may be mailed
  10381. to <I><A HREF="mailto:bug-bash@gnu.org">bug-bash@gnu.org</A></I> or posted to the Usenet
  10382. newsgroup
  10383. <A HREF="news:gnu.bash.bug">gnu.bash.bug</A>.
  10384. <P>
  10385. ALL bug reports should include:
  10386. <P>
  10387. <DL COMPACT>
  10388. <DT>The version number of <B>bash</B><DD>
  10389. <DT>The hardware and operating system<DD>
  10390. <DT>The compiler used to compile<DD>
  10391. <DT>A description of the bug behaviour<DD>
  10392. <DT>A short script or `recipe' which exercises the bug<DD>
  10393. </DL>
  10394. <P>
  10395. <I>bashbug</I>
  10396. inserts the first three items automatically into the template
  10397. it provides for filing a bug report.
  10398. <P>
  10399. Comments and bug reports concerning
  10400. this manual page should be directed to
  10401. <I><A HREF="mailto:chet.ramey@case.edu">chet.ramey@case.edu</A></I>.
  10402. <A NAME="lbDH">&nbsp;</A>
  10403. <H3>BUGS</H3>
  10404. <P>
  10405. It's too big and too slow.
  10406. <P>
  10407. There are some subtle differences between
  10408. <B>bash</B>
  10409. and traditional versions of
  10410. <B>sh</B>,
  10411. mostly because of the
  10412. <FONT SIZE=-1><B>POSIX</B>
  10413. </FONT>
  10414. specification.
  10415. <P>
  10416. Aliases are confusing in some uses.
  10417. <P>
  10418. Shell builtin commands and functions are not stoppable/restartable.
  10419. <P>
  10420. Compound commands and command sequences of the form `a ; b ; c'
  10421. are not handled gracefully when process suspension is attempted.
  10422. When a process is stopped, the shell immediately executes the next
  10423. command in the sequence.
  10424. It suffices to place the sequence of commands between
  10425. parentheses to force it into a subshell, which may be stopped as
  10426. a unit.
  10427. <P>
  10428. Array variables may not (yet) be exported.
  10429. <P>
  10430. There may be only one active coprocess at a time.
  10431. <HR>
  10432. <TABLE WIDTH=100%>
  10433. <TR>
  10434. <TH ALIGN=LEFT width=33%>GNU Bash 4.4<TH ALIGN=CENTER width=33%>2016 August 26<TH ALIGN=RIGHT width=33%>BASH(1)
  10435. </TR>
  10436. </TABLE>
  10437. <HR>
  10438. <A NAME="index">&nbsp;</A><H2>Index</H2>
  10439. <DL>
  10440. <DT><A HREF="#lbAB">NAME</A><DD>
  10441. <DT><A HREF="#lbAC">SYNOPSIS</A><DD>
  10442. <DT><A HREF="#lbAD">COPYRIGHT</A><DD>
  10443. <DT><A HREF="#lbAE">DESCRIPTION</A><DD>
  10444. <DT><A HREF="#lbAF">OPTIONS</A><DD>
  10445. <DT><A HREF="#lbAG">ARGUMENTS</A><DD>
  10446. <DT><A HREF="#lbAH">INVOCATION</A><DD>
  10447. <DT><A HREF="#lbAI">DEFINITIONS</A><DD>
  10448. <DT><A HREF="#lbAJ">RESERVED WORDS</A><DD>
  10449. <DT><A HREF="#lbAK">SHELL GRAMMAR</A><DD>
  10450. <DL>
  10451. <DT><A HREF="#lbAL">Simple Commands</A><DD>
  10452. <DT><A HREF="#lbAM">Pipelines</A><DD>
  10453. <DT><A HREF="#lbAN">Lists</A><DD>
  10454. <DT><A HREF="#lbAO">Compound Commands</A><DD>
  10455. <DT><A HREF="#lbAP">Coprocesses</A><DD>
  10456. <DT><A HREF="#lbAQ">Shell Function Definitions</A><DD>
  10457. </DL>
  10458. <DT><A HREF="#lbAR">COMMENTS</A><DD>
  10459. <DT><A HREF="#lbAS">QUOTING</A><DD>
  10460. <DT><A HREF="#lbAT">PARAMETERS</A><DD>
  10461. <DL>
  10462. <DT><A HREF="#lbAU">Positional Parameters</A><DD>
  10463. <DT><A HREF="#lbAV">Special Parameters</A><DD>
  10464. <DT><A HREF="#lbAW">Shell Variables</A><DD>
  10465. <DT><A HREF="#lbAX">Arrays</A><DD>
  10466. </DL>
  10467. <DT><A HREF="#lbAY">EXPANSION</A><DD>
  10468. <DL>
  10469. <DT><A HREF="#lbAZ">Brace Expansion</A><DD>
  10470. <DT><A HREF="#lbBA">Tilde Expansion</A><DD>
  10471. <DT><A HREF="#lbBB">Parameter Expansion</A><DD>
  10472. <DT><A HREF="#lbBC">Command Substitution</A><DD>
  10473. <DT><A HREF="#lbBD">Arithmetic Expansion</A><DD>
  10474. <DT><A HREF="#lbBE">Process Substitution</A><DD>
  10475. <DT><A HREF="#lbBF">Word Splitting</A><DD>
  10476. <DT><A HREF="#lbBG">Pathname Expansion</A><DD>
  10477. <DT><A HREF="#lbBH">Quote Removal</A><DD>
  10478. </DL>
  10479. <DT><A HREF="#lbBI">REDIRECTION</A><DD>
  10480. <DL>
  10481. <DT><A HREF="#lbBJ">Redirecting Input</A><DD>
  10482. <DT><A HREF="#lbBK">Redirecting Output</A><DD>
  10483. <DT><A HREF="#lbBL">Appending Redirected Output</A><DD>
  10484. <DT><A HREF="#lbBM">Redirecting Standard Output and Standard Error</A><DD>
  10485. <DT><A HREF="#lbBN">Appending Standard Output and Standard Error</A><DD>
  10486. <DT><A HREF="#lbBO">Here Documents</A><DD>
  10487. <DT><A HREF="#lbBP">Here Strings</A><DD>
  10488. <DT><A HREF="#lbBQ">Duplicating File Descriptors</A><DD>
  10489. <DT><A HREF="#lbBR">Moving File Descriptors</A><DD>
  10490. <DT><A HREF="#lbBS">Opening File Descriptors for Reading and Writing</A><DD>
  10491. </DL>
  10492. <DT><A HREF="#lbBT">ALIASES</A><DD>
  10493. <DT><A HREF="#lbBU">FUNCTIONS</A><DD>
  10494. <DT><A HREF="#lbBV">ARITHMETIC EVALUATION</A><DD>
  10495. <DT><A HREF="#lbBW">CONDITIONAL EXPRESSIONS</A><DD>
  10496. <DT><A HREF="#lbBX">SIMPLE COMMAND EXPANSION</A><DD>
  10497. <DT><A HREF="#lbBY">COMMAND EXECUTION</A><DD>
  10498. <DT><A HREF="#lbBZ">COMMAND EXECUTION ENVIRONMENT</A><DD>
  10499. <DT><A HREF="#lbCA">ENVIRONMENT</A><DD>
  10500. <DT><A HREF="#lbCB">EXIT STATUS</A><DD>
  10501. <DT><A HREF="#lbCC">SIGNALS</A><DD>
  10502. <DT><A HREF="#lbCD">JOB CONTROL</A><DD>
  10503. <DT><A HREF="#lbCE">PROMPTING</A><DD>
  10504. <DT><A HREF="#lbCF">READLINE</A><DD>
  10505. <DL>
  10506. <DT><A HREF="#lbCG">Readline Notation</A><DD>
  10507. <DT><A HREF="#lbCH">Readline Initialization</A><DD>
  10508. <DT><A HREF="#lbCI">Readline Key Bindings</A><DD>
  10509. <DT><A HREF="#lbCJ">Readline Variables</A><DD>
  10510. <DT><A HREF="#lbCK">Readline Conditional Constructs</A><DD>
  10511. <DT><A HREF="#lbCL">Searching</A><DD>
  10512. <DT><A HREF="#lbCM">Readline Command Names</A><DD>
  10513. <DT><A HREF="#lbCN">Commands for Moving</A><DD>
  10514. <DT><A HREF="#lbCO">Commands for Manipulating the History</A><DD>
  10515. <DT><A HREF="#lbCP">Commands for Changing Text</A><DD>
  10516. <DT><A HREF="#lbCQ">Killing and Yanking</A><DD>
  10517. <DT><A HREF="#lbCR">Numeric Arguments</A><DD>
  10518. <DT><A HREF="#lbCS">Completing</A><DD>
  10519. <DT><A HREF="#lbCT">Keyboard Macros</A><DD>
  10520. <DT><A HREF="#lbCU">Miscellaneous</A><DD>
  10521. <DT><A HREF="#lbCV">Programmable Completion</A><DD>
  10522. </DL>
  10523. <DT><A HREF="#lbCW">HISTORY</A><DD>
  10524. <DT><A HREF="#lbCX">HISTORY EXPANSION</A><DD>
  10525. <DL>
  10526. <DT><A HREF="#lbCY">Event Designators</A><DD>
  10527. <DT><A HREF="#lbCZ">Word Designators</A><DD>
  10528. <DT><A HREF="#lbDA">Modifiers</A><DD>
  10529. </DL>
  10530. <DT><A HREF="#lbDB">SHELL BUILTIN COMMANDS</A><DD>
  10531. <DT><A HREF="#lbDC">RESTRICTED SHELL</A><DD>
  10532. <DT><A HREF="#lbDD">SEE ALSO</A><DD>
  10533. <DT><A HREF="#lbDE">FILES</A><DD>
  10534. <DT><A HREF="#lbDF">AUTHORS</A><DD>
  10535. <DT><A HREF="#lbDG">BUG REPORTS</A><DD>
  10536. <DT><A HREF="#lbDH">BUGS</A><DD>
  10537. </DL>
  10538. <HR>
  10539. This document was created by man2html from bash.1.<BR>
  10540. Time: 31 August 2016 10:24:30 EDT
  10541. </BODY>
  10542. </HTML>