?? rose94.ps
字號:
(he special meaning of characters or w).15 F 3.35(ords. It)-.1 F .85(can disable special treat-)3.35 F .314(ment for shell operators or other special characters, pre)72 123.6 R -.15(ve)-.25 G .315(nt reserv).15 F .315(ed w)-.15 F .315(ords from being recognized as such,)-.1 F .683(and inhibit v)72 135.6 R .683(ariable e)-.25 F 3.183(xpansion. The)-.15 F .683(shell has three quoting mechanisms:)3.183 F 3.183(ab)5.683 G .683(ackslash preserv)387.413 135.6 R .682(es the literal)-.15 F -.25(va)72 147.6 S.417(lue of the ne).25 F .417(xt character)-.15 F 2.917(,ap)-.4 G .417(air of single quotes preserv)196.712 147.6 R .417(es the literal v)-.15 F .418(alue of each character between the)-.25 F 1.426(quotes, and a pair of double quotes preserv)72 159.6 R 1.425(es the literal meaning of enclosed characters while allo)-.15 F(wing)-.25 E(some e)72 171.6 Q(xpansions.)-.15 E 1.054(Some of the commands b)97 187.2 R1.054(uilt into the shell are part of the programming language.)-.2 F(The)6.055E/F2 10/Times-Bold@0 SF(br)3.555 E(eak)-.18 E F0(and)3.555 E F2(continue)72199.2 Q F0 1.175(commands control loop e)3.675 F -.15(xe)-.15 G 1.175(cution as in the C language.).15 F(The)6.175 E F2 -2.3 -.15(ev a)3.675 H(l).15E F0 -.2(bu)3.675 G 1.174(iltin allo).2 F 1.174(ws a string to be)-.25 F .204(parsed and e)72 211.2 R -.15(xe)-.15 G .204(cuted as a command.).15 F F2 -.65(Wa)5.205 G(it).65 E F0 .205(tells the shell to pause until the processes speci\214ed as ar)2.705 F(guments)-.18 E(ha)72 223.2 Q .3 -.15(ve ex)-.2 H(ited.).15 E F2 2.5(2.3. Interacti)72 247.2 R .2 -.1(ve F)-.1 H(eatur)-.15 E(es)-.18 E F0 .51(Shells ha)97 262.8 R .81 -.15(ve b)-.2 H -.15(eg).15 G .51(un of).15 F .51(fering features geared speci\214cally for interacti)-.25 F .81 -.15(ve u)-.25H .51(se rather than to augment the).15 F .76(programming language.)72 274.8 R.761(These interacti)5.76 F 1.061 -.15(ve f)-.25 H .761(eatures include job control, command line editing, history and).15 F(aliases.)72 286.8 Q .626(Job control is a f)97 302.4 R .626(acility pro)-.1 F .626(vided jointly by the shell and the)-.15 F/F3 9/Times-Roman@0 SF(UNIX)3.125 EF0 -.1(ke)3.125 G .625(rnel that allo).1 F .625(ws users to selec-)-.25 F(ti)72314.4 Q -.15(ve)-.25 G .344(ly stop \(suspend\) and restart \(resume\) processes.).15 F .345(Each pipeline e)5.345 F -.15(xe)-.15 G .345(cuted by the shell is referred to as a).15 F F1(job)72 326.4 Q F0 2.989(.J)C.488(obs may be suspended and restarted in either the fore)94.159 326.4 R .488(ground, where the)-.15 F 2.988(yh)-.15 G -2.25 -.2(av e)397.148 326.4 T .488(access to the terminal,)3.188 F .833(or background, where the)72 338.4 R 3.333(ya)-.15 G .834(re isolated and cannot read from the terminal.)189.312 338.4 R-.8(Ty)5.834 G .834(ping the).8 F F1(suspend)3.334 E F0(character)5 E .459(whi\le a process is running stops that process and returns control to the shell.)72350.4 R .459(Once a job is suspended, the)5.459 F .392(user manipulates the job')72 362.4 R 2.892(ss)-.55 G .392(tate, using)184.118362.4 R F2(bg)2.892 E F0 .393(to continue it in the background,)2.892 F F2(fg)2.893 E F0 .393(to return it to the fore)2.893 F(ground)-.15 E .891(and a)72374.4 R -.1(wa)-.15 G .891(it its completion, or).1 F F2(kill)3.391 E F0 .891(to send it a signal.)3.391 F(The)5.89 E F2(jobs)3.39 E F0 .89(command lists the status of jobs, and)3.39 F F2(wait)3.39 E F0 .407(will pause the shell until a speci\214ed job terminates.)72 386.4 R .407(The shell pro)5.407 F .407(vides a number of w)-.15 F .407(ays to refer to a job,)-.1 F(and will notify the user whene)72 398.4 Q -.15(ve)-.25 G 2.5(rab).15 G(ackground job terminates.)220.18 398.4 Q -.4(Wi)97 414S .956(th the adv).4 F .956(ent of more po)-.15 F .956(werful terminals and terminal emulators, more sophisticated interaction)-.25 F.253(than that pro)72 426 R .253(vided by the)-.15 F F3(UNIX)2.753 E F0 -.1(ke)2.754 G .254(rnel terminal dri).1 F -.15(ve)-.25 G 2.754(ri).15 G 2.754(sp)293.592 426 S 2.754(ossible. Some)305.236 426 R .254(shells of)2.754 F .254(fer command line editing,)-.25 F 1.141(which permits a user to edit lines of input using f)72 438 R(amiliar)-.1 E F1(emacs)3.64 E F0(or)3.64 E F1(vi)3.64 E F0 1.14(-style commands before submitting)B .02(them to the shell.)72 450 R .02(Editors allo)5.02 F 2.52(wc)-.25 G .02(orrections to be made without ha)206.31450 R .021(ving to erase back to the point of error)-.2 F 2.521(,o)-.4 G(r)500.67 450 Q .135(start the line ane)72 462 R 3.935 -.65(w. C)-.25 H .135(ommand line editors run the g).65 F .135(amut from a small \214x)-.05 F .134(ed set of commands and k)-.15 F .434 -.15(ey b)-.1 H(ind-).15 E(ings to input f)72 474 Q(acilities which allo)-.1 E 2.5(wa)-.25 G(rbitrary actions to be bound to a k)217.2 474 Q .3 -.15(ey o)-.1 H 2.5(rk).15G .3 -.15(ey s)379.88 474 T(equence.).15 E .145(Modern shells also k)97 489.6 R.145(eep a history)-.1 F 2.645(,w)-.65 G .146(hich is the list of commands a user has typed.)243.49 489.6 R .146(Shell f)5.146 F .146(acilities are)-.1 F -.2(av)72 501.6 S .368(ailable to recall pre)-.05 F .367(vious commands and use portions of old commands when composing ne)-.25 F 2.867(wo)-.25 G 2.867(nes. The)467.253 501.6 R 1.456(command history can be sa)72 513.6 R -.15(ve)-.2 G 3.957(dt).15 G 3.957(oa\214)207.522 513.6 S 1.457(le and read back in at shell startup, so it persists across sessions.)230.436513.6 R .675(Shells which pro)72 525.6 R .675(vide both command editing and history generally ha)-.15 F .974 -.15(ve e)-.2 H.674(diting commands to interacti).15 F -.15(ve)-.25 G(ly).15 E(step forw)72537.6 Q(ard and backw)-.1 E(ard through the history list.)-.1 E .013(Aliases allo)97 553.2 R -5.012 2.513(wa s)-.25 H .014(tring to be substituted for a command name.)164.28 553.2 R(The)5.014 E 2.514(yc)-.15 G .014(an be used to create a mnemonic)373.396 553.2 R .568(for a)72565.2 R F3(UNIX)3.068 E F0 .568(command name \()3.068 F/F4 10/Courier@0 SF .568(alias del=rm)B F0 .568(\), to e)B .567(xpand a single w)-.15 F .567(ord to a comple)-.1 F 3.067(xc)-.15 G .567(ommand \()432.603 565.2 R F4(alias)A .255(news='xterm -g 80x45 -title trn -e trn -e -S1 -N &')72 577.2 R F0 .255(\), or to ensure that a command)B(is in)72 589.2 Q -.2(vo)-.4 G -.1(ke).2 G2.5(dw).1 G(ith a basic set of options \()122.41 589.2 Q F4(alias ls="/bin/ls -F")A F0(\).)A F2 2.5(3. The)72 613.2 R(POSIX Shell Standard)2.5 E F1(POSIX)97 628.8 Q F0 .239(is a name originally coined by Richard Stallman for a f)4.405 F .239(amily of open system standards based)-.1 F(on)72 640.8 Q F3(UNIX)3.239 E F05.739(.T)C .74(here are a number of aspects of)122.079 640.8 R F3(UNIX)3.24 EF0 .74(under consideration for standardization, from the basic)3.24 F .192(system services at the system call and C library le)72 652.8 R -.15(ve)-.25 G2.692(lt).15 G 2.692(oa)290.16 652.8 S .191(pplications and tools to system administration and)302.292 652.8 R 2.5(management. Each)72 664.8 R(area of standardization is assigned to a w)2.5 E(orking group in the 1003 series.)-.1 E 3.602(The POSIX Shell and T)97 680.4 R3.602(ools standard has been de)-.8 F -.15(ve)-.25 G 3.603(loped by IEEE W).15F 3.603(orking Group 1003.2)-.8 F -1.667(\(POSIX.2\) [4].)72 692.4 R 2.799(It concentrates on the command interpreter interf)7.799 F 2.799(ace and utility programs commonly)-.1 F -.15(exe)72 704.4 S 2.345(cuted from the command line or by other programs.).15 F 2.345(An initial v)7.345 F 2.345(ersion of the standard has been)-.15 F(appro)72 716.4 Q -.15(ve)-.15 G 2.915(da).15 G .414(nd published by the IEEE, and w)116.265 716.4 R .414(ork is currently underw)-.1 F .414(ay to update it.)-.1 F .414(There are four primary)5.414 F(areas of w)72 728.4 Q(ork in the 1003.2 standard:)-.1 E EP%%Page: 4 4%%BeginPageSetupBP%%EndPageSetup/F0 10/Times-Roman@0 SF 2.5(-4-)279.67 48 S 21.5<8341>72 84 S .835(spects of the shell')104.22 84 R 3.335(ss)-.55 G .835(yntax and command language.)192 84 R 3.335(An)5.835 G .835(umber of special b)338.095 84 R .835(uiltins such as)-.2 F/F1 10/Times-Bold@0 SF(cd)3.335 E F0(and)3.335 E F1(exec)97 96 Q F0 .545(are being speci\214ed as part of the shel\l, since their functionality usually cannot be implemented)3.046 F(by a separate e)97 108 Q -.15(xe)-.15 G(cutable;).15 E 21.5<8341>72 123.6 S.73(set of utilities to be called by shell scripts and applications.)107.45123.6 R .731(Examples are programs lik)5.731 F(e)-.1 E/F2 10/Times-Italic@0 SF2.397(sed, tr)3.231 F(,)-1.11 E F0(and)97 135.6 Q F2(awk.)2.853 E F0 .352(Utilities commonly implemented as shell b)4.519 F .352(uiltins are described in this section, such as)-.2 F F1(test)2.852 E F0(and)97147.6 Q F1(kill)3.422 E F0 5.922(.A)C 3.422(ne)144.404 147.6 S .922(xpansion of this section')157.116 147.6 R 3.423(ss)-.55 G .923(cope, termed the User Portability Extension, or UPE, has)268.586 147.6 R(standardized interacti)97 159.6 Q .3 -.15(ve p)-.25 H(rograms such as).15 E F2(vi)2.5 E F0(and)4.166 E F2(mailx;)2.5 E F0 21.5<8341>72 175.2 S .926(group of functional interf)107.646 175.2 R .926(aces to services pro)-.1 F.926(vided by the shell, such as the traditional)-.15 F F2(system)3.425 E F0(C)5.091 E .507(library function.)97 187.2 R .507(There are functions to perform shell w)5.507 F .508(ord e)-.1 F .508(xpansions, perform \214lename e)-.15 F(xpansion)-.15 E(\()97 199.2 Q F2(globbing)A F0 .58(\), obtain v)B .58(alues of POSIX.2 system con\214guration v)-.25 F .58(ariables, retrie)-.25 F.88 -.15(ve v)-.25 H .58(alues of en)-.1 F(vironment)-.4 E -.25(va)97 211.2 S(riables \().25 E F2 -.1(ge)C(ten).1 E(v\(\))-.4 E F0(\), and other services;).833 E 21.5<8341>72 226.8 S(suite of `)106.72 226.8 Q(`de)-.74 E -.15(ve)-.25 G(lopment').15 E 2.5('u)-.74 G(tilities such as)209.54 226.8 Q F2(c89)2.5 E F0(\(the POSIX.2 v)4.166 E(ersion of)-.15 E F2(cc)2.5 E F0(\), and)A F2(yacc.)2.5E F0 .483(Bash is concerned with the aspects of the shell')97 242.4 R 2.983(sb)-.55 G(eha)301.597 242.4 Q .484(vior de\214ned by POSIX.2.)-.2 F .484(The shell command)5.484 F 1.439(language has of course been standardized, including the basic \215o)72 254.4 R3.938(wc)-.25 G 1.438(ontrol and program e)359.688 254.4 R -.15(xe)-.15 G 1.438(cution con-).15 F 1.145(structs, I/O redirection and pipelining, ar)72 266.4 R1.145(gument handling, v)-.18 F 1.145(ariable e)-.25 F 1.146(xpansion, and quoting.)-.15 F(The)6.146 E F2(special)3.646 E F0 -.2(bu)72278.4 S .676(iltins, which must be implemented as part of the shell to pro).2 F.676(vide the desired functionality)-.15 F 3.176(,a)-.65 G .676(re speci\214ed)457.504 278.4 R .7(as being part of the shell; e)72 290.4 R .7(xamples of these are)-.15 F F1 -2.3 -.15(ev a)3.201 H(l).15 E F0(and)3.201 EF1(export)3.201 E F0 5.701(.O)C .701(ther utilities appear in the sections of)352.034 290.4 R .256(POSIX.2 not de)72 302.4 R -.2(vo)-.25 G .256(ted to the s\hell which are commonly \(and in some cases must be\) implemented as b).2 F(uiltin)-.2 E(commands, such as)72 314.4 Q F1 -.18(re)2.5 G(ad).18 E F0(and)2.5E F1(test)2.5 E F0(.)A .972(POSIX.2 also speci\214es aspects of the shell')97330 R 3.473(si)-.55 G(nteracti)286.016 330 Q 1.273 -.15(ve b)-.25 H(eha).15 E.973(vior as part of the UPE, including job)-.2 F .233(control, command line editing, and history)72 342 R 5.233(.I)-.65 G .233(nterestingly enough, only)253.849 342 R F2(vi)2.733 E F0 .233(-style line editing commands ha)B -.15(ve)-.2 G(been standardized;)72 354 Q F2(emacs)2.5 E F0(editing commands were left out due to objections.)2.5 E .148(There were certain areas in which POSIX.2 felt standardization w)97 369.6 R.149(as necessary)-.1 F 2.649(,b)-.65 G .149(ut no e)420.643 369.6 R .149(xisting imple-)-.15 F 1.598(mentation pro)72 381.6 R 1.598(vided the proper beha)-.15 F(vior)-.2 E 6.598(.T)-.55 G 1.598(he w)251.56381.6 R 1.597(orking group in)-.1 F -.15(ve)-.4 G 1.597(nted and standardized functionality in).15 F .228(these areas.)72 393.6 R(The)5.228 E F1(command)2.728 E F0 -.2(bu)2.728 G .228(iltin w).2 F .228(as in)-.1 F-.15(ve)-.4 G .228(nted so that shell functions could be written to replace b).15 F(uiltins;)-.2 E 1.663(it mak)72 405.6 R 1.663(es the capabilities of the b)-.1 F 1.663(uiltin a)-.2 F -.25(va)-.2 G 1.663(ilable to the function.).25 F 1.663(The reserv)6.663 F 1.663(ed w)-.15 F 1.663(ord `)-.1 F(`!')-.74 E 4.163('w)-.74 G 1.663(as added to)455.685 405.6 R(ne)72417.6 Q -.05(ga)-.15 G .915(te the return v).05 F .915(alue of a command or pipeline; it w)-.25 F .916(as nearly impossible to e)-.1F .916(xpress `)-.15 F .916(`if not x')-.74 F 3.416('c)-.74 G(leanly)479.56417.6 Q .904(using the sh language.)72 429.6 R .904(There e)5.904 F .904(xist multiple incompatible implementations of the)-.15 F F1(test)3.403 E F0-.2(bu)3.403 G .903(iltin, which tests).2 F .28(\214les for type and other attrib)72 441.6 R .281(utes and performs arithmetic and string comparisons.)-.2 F .281(POSIX considered none)5.281 F .868(of these correct, so the standard beha)72453.6 R .868(vior w)-.2 F .868(as speci\214ed in terms of the number of ar)-.1F .867(guments to the com-)-.18 F 3.803(mand. POSIX.2)72 465.6 R 1.303(dictates e)3.803 F 1.303(xactly what will happen when four or fe)-.15 F 1.303(wer ar)-.25 F 1.303(guments are gi)-.18 F -.15(ve)-.25 G 3.803(nt).15 G(o)459.462 465.6 Q F1(test)3.804 E F0 3.804(,a)C(nd)494 465.6 Q(lea)72 477.6 Q-.15(ve)-.2 G 4.531(st).15 G 2.031(he beha)103.951 477.6 R 2.031(vior unde\214ned when more ar)-.2 F 2.031(guments are supplied.)-.18 F 2.03(Bash uses the POSIX.2 algorithm,)7.031 F(which w)72 489.6 Q(as concei)-.1 E-.15(ve)-.25 G 2.5(db).15 G 2.5(yD)164.53 489.6 S -.2(av)179.25 489.6 S(id K).2E(orn.)-.35 E 1.128(While POSIX.2 includes much of what the shell has traditionally pro)97 505.2 R1.129(vided, some important things)-.15 F(ha)72 517.2 Q .58 -.15(ve b)-.2 H .28(een omitted as being `).15 F(`be)-.74 E .28(yond its scope.)-.15 F 4.26 -.74('' T)-.7 H .28(here is, for instance, no mention of a dif).74 F .28(ference between)-.25 F(a)72 529.2 Q F2(lo)3.354 E(gin)-.1 E F0 .854(shell and an)5.02 F 3.354(yo)-.15 G .854(ther interacti)167.956 529.2 R 1.154-.15(ve s)-.25 H .854(hell \(since POSIX.2 does not specify a login program\).).15 F .855(No \214x)5.855 F(ed)-.15 E(startup \214les are de\214ned, either \255 the standard does not mention)72541.2 Q F2(.pr)2.5 E(o\214le)-.45 E F0(.)1.666 E F1 2.5(4. Shell)72 565.2 R(Comparison)2.5 E F0 .693(This section compares features of bash, sh, and ksh \\(the three shells closest to POSIX compliance\).)97 580.8 R .245(Since ksh an\d bash are supersets of sh, the features common to all three are co)72 592.8 R-.15(ve)-.15 G .245(red \214rst.).15 F .245(Some of the fea-)5.245 F 1.198(tures bash and ksh contain which are not in sh will be discussed.)72 604.8 R
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -