?? rose94.ps
字號:
of features unique to bash.)108 261 R(Finally)108 273 Q 3.178(,s)-.65 G .678(ome of the changes and ne)145.258 273 R 3.178(wf)-.25 G .678(eatures to appear in the ne)268.486 273 R .678(xt bash release will be)-.15 F(discussed.)108 285 Q/F3 10/Times-Bold@0 SF 2.5(1. Intr)72 321 R(oduction)-.18E(Bash)97 336.6 Q F2 .904(is the shell, or command language interpreter)3.404 F3.404(,t)-.4 G .904(hat will appear in the GNU operating system.)316.032 336.6R .782(The name is an acron)72 348.6 R .782(ym for the `)-.15 F(`Bourne\255Ag)-.74 E .782(ain SHell')-.05 F .782(', a pun on Ste)-.74 F 1.082 -.15(ve B)-.25H .783(ourne, the author of the direct).15 F .212(ancestor of the current)72360.6 R/F4 9/Times-Roman@0 SF(UNIX)2.712 E F2 2.712<8773>C(hell)199.131 360.6 QF1(/bin/sh)2.712 E F2 2.712(,w)C .212(hich appeared in the Se)256.505 360.6 R-.15(ve)-.25 G .211(nth Edition Bell Labs Research v).15 F(er)-.15 E(-)-.2 E(sion of)72 372.6 Q F4(UNIX)2.5 E F2([1].).833 E .191(Bash is an)97 388.2 R F3(sh)2.691 E F2 .192(\255compatible shell that incorporates useful features from the K)B .192(orn shell \()-.35 F F3(ksh)A F2 .833(\)[)C .192(2] and the)-.833 F 2.767(Cs)72400.2 S .267(hell \()85.327 400.2 R F3(csh)A F2 .833(\)[)C .267(3], described later in this article.)-.833 F .266(It is ultimately intended to be a conformant implementation)5.267 F 1.965(of the IEEE POSIX Shell and T)72 412.2 R 1.966(ools speci\214cation \(IEEE W)-.8 F 1.966(orking Group 1003.2\).)-.8 F 1.966(It of)6.966 F 1.966(fers functional)-.25 F(impro)72 424.2 Q -.15(ve)-.15 G(ments o).15 E -.15(ve)-.15 G 2.5(rs).15 G 2.5(hf)155.28 424.2 S(or both interacti)166.11 424.2 Q .3-.15(ve a)-.25 H(nd programming use.).15 E .802(While the GNU operating system will most lik)97 439.8 R .801(ely include a v)-.1 F .801(ersion of the Berk)-.15 F(ele)-.1 E 3.301(ys)-.15 G .801(hell csh, bash)448.238 439.8 R .108(will be the def)72 451.8 R .108(ault shell.)-.1 F(Lik)5.108 E 2.608(eo)-.1 G .108(ther GNU softw)199.658 451.8R .108(are, bash is quite portable.)-.1 F .109(It currently runs on nearly e)5.109 F -.15(ve)-.25 G(ry).15 E -.15(ve)72 463.8 S .367(rsion of).15 F F4(UNIX)2.867 E F2 .367(and a fe)2.867 F 2.867(wo)-.25 G .367(ther operating systems \255 an independently-supported port e)187.933 463.8 R.366(xists for OS/2, and)-.15 F .706(there are rumors of ports to DOS and W)72475.8 R(indo)-.4 E .706(ws NT)-.25 F 5.706(.P)-.74 G .706(orts to)295.97 475.8R F4(UNIX)3.206 E F2(-lik)A 3.206(es)-.1 G .706(ystems such as QNX and Minix)372.979 475.8 R(are part of the distrib)72 487.8 Q(ution.)-.2 E .51(The original author of bash w)97 503.4 R .51(as Brian F)-.1 F .509(ox, an emplo)-.15 F .509(yee of the Free Softw)-.1 F .509(are F)-.1 F 3.009(oundation. The)-.15 F(cur)3.009 E(-)-.2 E(rent de)72 515.4 Q -.15(ve)-.25 G(loper and maintainer is Chet Rame).15 E 1.3 -.65(y, a v)-.15 H(olunteer who w).45 E(orks at Case W)-.1 E(estern Reserv)-.8 E 2.5(eU)-.15 G(ni)458.91 515.4 Q-.15(ve)-.25 G(rsity).15 E(.)-.65 E F3 2.5(2. What)72 539.4 R(is a shell?)2.5 EF2 1.241(At its base, a shell is simply a macro processor that e)97 555 R -.15(xe)-.15 G 1.242(cutes commands.).15 F(A)6.242 E F4(UNIX)3.742 E F2 1.242(shell is both a)3.742 F .189(command interpreter)72 567 R 2.688(,w)-.4 G .188(hich pro)167.787 567 R .188(vides the user interf)-.15 F .188(ace to the rich set of)-.1 F F4(UNIX)2.688 E F2 .188(utilities, and a programming)2.688 F .751(language, allo)72 579 R .752(wing these utilitites to be combined.)-.25 F .752(The shell reads commands either from a terminal or a)5.752 F 2.52(\214le. Files)72 591 R .019(containing commands can be created, and become commands themselv)2.52 F 2.519(es. These)-.15 F(ne)2.519 E 2.519(wc)-.25 G(ommands)465.11 591 Q(ha)72 603 Q.395 -.15(ve t)-.2 H .095(he same status as system commands in directories lik).15 F(e)-.1 E F3(/bin)2.595 E F2 2.595(,a)C(llo)342.575 603 Q .096(wing users or groups to establish cus-)-.25 F(tom en)72 615 Q(vironments.)-.4E F3 2.5(2.1. Command)72 639 R(Inter)2.5 E(pr)-.1 E(eter)-.18 E F2 2.926(As)97654.6 S .426(hell allo)111.036 654.6 R .426(ws e)-.25 F -.15(xe)-.15 G .426(cution of).15 F F4(UNIX)2.926 E F2 .426(commands, both synchronously and asynchronously)2.926 F 5.425(.T)-.65 G(he)460.165 654.6 Q F1 -.37(re)2.925 G(dir).37 E(ec-)-.37 E(tion)72 666.6 Q F2 .334(constructs permit \214ne-grained control of the input and output of those com\mands, and the shell allo)2.833 F(ws)-.25 E .559(control o)72 678.6 R -.15(ve)-.15 G 3.058(rt).15 G .558(he contents of their en)126.697 678.6 R(vironment.)-.4 E F4(UNIX)5.558 E F2 .558(shells also pro)3.058 F .558(vide a small set of b)-.15 F .558(uilt-in commands)-.2 F(\()72 690.6 Q F1 -.2(bu)C(iltins).2 E F2 4.611(\)i)C 2.112(mplementing functionality impossible \(e.g.,)115.861 690.6 R F3(cd)4.612 E F2(,)A F3(br)4.612 E(eak)-.18 E F2(,)A F3(continue)4.612 E F2 4.612(,a)C(nd)399.074 690.6 Q F3(exec)4.612 E F2 4.612(\)o)C 4.612(ri)444.948 690.6 S(ncon)455.67 690.6 Q -.15(ve)-.4 G(nient).15 E .32 LW 76 700.6 72 700.6 DL 80 700.676 700.6 DL 84 700.6 80 700.6 DL 88 700.6 84 700.6 DL 92 700.6 88 700.6 DL 96700.6 92 700.6 DL 100 700.6 96 700.6 DL 104 700.6 100 700.6 DL 108 700.6 104700.6 DL 112 700.6 108 700.6 DL 116 700.6 112 700.6 DL 120 700.6 116 700.6 DL124 700.6 120 700.6 DL 128 700.6 124 700.6 DL 132 700.6 128 700.6 DL 136 700.6132 700.6 DL 140 700.6 136 700.6 DL 144 700.6 140 700.6 DL/F5 8/Times-Roman@0SF 2<8755>72 710.6 S(NIX is a trademark of X/OPEN)83.776 710.6 Q EP%%Page: 2 2%%BeginPageSetupBP%%EndPageSetup/F0 10/Times-Roman@0 SF 2.5(-2-)279.67 48 S(\()72 84 Q/F1 10/Times-Bold@0 SF(history)A F0(,)A F1(getopts)3.505 E F0(,)A F1(kill)3.505 E F0 3.505(,o)C(r)172.795 84 Q F1(pwd)3.505 E F0 3.505(,f)C 1.005(or e)207.305 84 R 1.005(xample\) to obtain via separate utilities.)-.15 F 1.005(Shells may be used interac-)6.005 F(ti)72 96 Q -.15(ve)-.25 G(ly or non-interacti).15 E -.15(ve)-.25 G 2.5(ly: the).15 F 2.5(ya)-.15 G(ccept input typed from the k)207.42 96 Q -.15(ey)-.1 G(board or from a \214le.).15 E F1 2.5(2.2. Pr)72 120 R(ogramming Language)-.18E F0 .501(While e)97 135.6 R -.15(xe)-.15 G .501(cuting commands is essential, most of the po).15 F .501(wer \(and comple)-.25F .502(xity\) of shells is due to their)-.15 F .05(embedded programming languages.)72 147.6 R(Lik)5.049 E 2.549(ea)-.1 G .349-.15(ny h)245.398 147.6 T(igh-le).15 E -.15(ve)-.25 G 2.549(ll).15 G .049(anguage, the shell pro)303.276 147.6 R .049(vides v)-.15 F .049(ariables, \215o)-.25 F 2.549(wc)-.25 G(ontrol)480.11 147.6 Q(constructs, quoting, and functions.)72 159.6 Q .475(The basic syntactic element is a)97 175.2 R/F2 10/Times-Italic@0 SF .475(simple command)2.975 F F0 5.475(.A)C .475(simple command consists of an optional set of)315.405 175.2 R -.25(va)72 187.2S .525(riable assignments, a command w).25 F .525(ord, and an optional list of ar)-.1 F 3.024(guments. Operators)-.18 F .524(to redirect input and)3.024 F(output may appear an)72 199.2 Q(ywhere in a simple command.)-.15 E(Some e)5 E(xamples are:)-.15 E/F3 10/Courier@0 SF(who)97 211.2 Q(trn -e -S1 -N)97 223.2 Q(ls -l /bin > binfiles)97235.2 Q(make > make.out 2>make.errs)97 247.2 Q F0 2.518(Ap)97 262.8 S .018(ipeline is a sequence of tw)111.738 262.8 R 2.518(oo)-.1 G 2.518(rm)230.056262.8 S .018(ore commands separated by the character)243.684 262.8 R/F4 10/Symbol SF<ef>2.519 E F0 5.019(.T)C .019(he standard output)430.082 262.8 R(of the \214rst command is connected to the standard input of the second.)72274.8 Q(Examples of pipelines include:)5 E F3(who | wc -l)97 286.8 Q(ls -l | sort +3nr)97 298.8 Q F0 .578(Simple commands and pipelines may be combined into)97 314.4 R F2(lists)3.078 EF0 5.578(.A)C .578(list is a sequence of pipelines sepa-)360.002 314.4 R .289(rated by one of)72 326.4 R F1(;)2.789 E F0(,)A F1(&)2.789 E F0(,)A F1(&&)2.789E F0 2.789(,o)C(r)185.103 326.4 Q F4<efef>2.789 E F0 2.789(,a)C .289(nd optionally terminated by)210.831 326.4 R F1(;)2.789 E F0(,)A F1(&)2.789 EF0 2.789(,o)C 2.789(ran)352.555 326.4 S -.25(ew)370.903 326.4 S 2.789(line. Commands).25 F .289(separated by)2.789 F F1(;)72 338.4 Q F0 .336(are e)2.836 F -.15(xe)-.15 G .336(cuted sequentially; the shell w).15 F .335(aits for each to complete in turn.)-.1 F .335(If a command is terminated by)5.335 F F1(&)2.835 E F0(,)A .007(the shell e)72 350.4 R -.15(xe)-.15 G .007(cutes it in the).15 F F2(bac)2.507 E(kgr)-.2 E(ound)-.45 E F0 2.508(,a)1.666 G.008(nd does not w)236.076 350.4 R .008(ait for it to \214nish.)-.1 F .008(If tw)5.008 F 2.508(oc)-.1 G .008(ommands are separated by)397.616 350.4 R F1(&&)72 362.4 Q F0 3.008(,t)C .508(he second command e)96.948 362.4 R -.15(xe)-.15 G .508(cutes only if the \214rst command succeeds.).15 F 3.007(As)5.508 G.507(eparator of)383.575 362.4 R F4<efef>3.007 E F0 .507(causes the sec-)3.007F(ond command to e)72 374.4 Q -.15(xe)-.15 G(cute only if the \214rst f).15 E2.5(ails. Some)-.1 F -.15(ex)2.5 G(amples are:).15 E F3(who ; date)97 386.4 Q(cd /usr/src || exit 1)97 398.4 Q(cd "$@" && xtitle $HOST: $PWD)97 410.4 Q F01.36(The shell programming language pro)97 426 R 1.361(vides a v)-.15 F 1.361(ariety of \215o)-.25 F 3.861(wc)-.25 G 1.361(ontrol structures.)353.276 426 R(The)6.361 E F1 -.25(fo)3.861 G(r).25 E F0(command)3.861 E(allo)72 438 Q .654(ws a list of commands to be e)-.25 F -.15(xe)-.15 G .654(cuted once for each w).15 F .654(ord in a w)-.1 F .654(ord list.)-.1 F(The)5.654 E F1(case)3.154 E F0 .654(command allo)3.154 F .654(ws a)-.25 F .627(list to be e)72 450 R -.15(xe)-.15 G .628(cuted if a w).15 F .628(ord matches a speci\214ed pattern.)-.1 F(The)5.628 E F1(while)3.128 E F0(and)3.128 E F1(until)3.128 E F0 .628(commands e)3.128 F -.15(xe)-.15 G .628(cute a list of).15 F 1.559(commands as long as a guard command completes successfully or f)72 462 R 1.559(ails, respecti)-.1 F -.15(ve)-.25 G(ly).15 E 6.559(.T)-.65 G(he)440.892 462 QF1(if)4.059 E F0(command)4.059 E(allo)72 474 Q(ws e)-.25 E -.15(xe)-.15 G(cution of dif).15 E(ferent command lists depending on the e)-.25 E(xit status of a guard command.)-.15 E(A)97 489.6 Q F2 .385(shell function)2.885 F F0 .385(associates a list of commands with a name.)2.885 F .386(Each time the name is used as a simple)5.385 F .938(command, the list is e)72501.6 R -.15(xe)-.15 G 3.438(cuted. This).15 F -.15(exe)3.438 G .938(cution tak).15 F .938(es place in the current shell conte)-.1 F .937(xt; no ne)-.15 F 3.437(wp)-.25 G .937(rocess is)468.903 501.6 R 2.5(created. Functions)72 513.6 R(may ha)2.5 E .3 -.15(ve t)-.2 H(heir o).15 E(wn ar)-.25 E(gument lists and local v)-.18 E(ariables, and may be recursi)-.25E -.15(ve)-.25 G(.).15 E .722(The shell language pro)97 529.2 R .722(vides v)-.15 F .722(ariables, which may be both set and referenced.)-.25 F 3.222(An)5.722 G .722(umber of special)435.906 529.2 R 1.02(parameters are present, such as)72 541.2 R F1($@)3.519 E F0 3.519(,w)C 1.019(hich returns the shell')231.257 541.2 R 3.519(sp)-.55 G 1.019(ositional parameters \(command-line ar)333.103 541.2 R(gu-)-.18 E(ments\),)72553.2 Q F1($?)2.906 E F0 2.906(,t)C .406(he e)122.812 553.2 R .406(xit status of the pre)-.15 F .406(vious command, and)-.25 F F1($$)2.906 E F02.906(,t)C .406(he shell')322.436 553.2 R 2.906(sp)-.55 G .406(rocess I.D.)368.248 553.2 R .407(In addition to pro)5.406 F(vid-)-.15 E .129(ing special parameters and user)72 565.2 R .129(-de\214ned v)-.2 F .129(ariables, the shell permits the v)-.25 F .128(alues of certain v)-.25 F .128(ariables to control)-.25 F .16(its beha)72 577.2 R(vior)-.2 E 5.16(.S)-.55 G.16(ome of these v)131.57 577.2 R .16(ariables include)-.25 F F1(IFS)2.661 E F02.661(,w)C .161(hich controls ho)284.202 577.2 R 2.661(wt)-.25 G .161(he shell splits w)361.375 577.2 R(ords,)-.1 E F1 -.74(PA)2.661 G(TH)-.21 E F02.661(,w)C(hich)486.78 577.2 Q .392(tells the shell where to look for commands, and)72 589.2 R F1(PS1)2.892 E F02.892(,w)C .392(hose v)297.01 589.2 R .392(alue is the string the shell uses to prompt for)-.25 F 3.371(commands. There)72 601.2 R .871(are a fe)3.371 F 3.371(wv)-.25 G .871(ariables whose v)196.645601.2 R .871(alues are set by the shell and normally only referenced by)-.25 F(users;)72 613.2 Q F1(PWD)3.663 E F0 3.663(,w)C 1.163(hose v)135.706 613.2 R1.163(alue is the pathname of the shell')-.25 F 3.662(sc)-.55 G 1.162(urrent w)313.068 613.2 R 1.162(orking directory)-.1 F 3.662(,i)-.65 G 3.662(so)421.894613.2 S 1.162(ne such v)434.446 613.2 R(ariable.)-.25 E -1.11(Va)72 625.2 S.008(riables can be used in nearly an)1.11 F 2.509(ys)-.15 G .009(hell conte)219.37 625.2 R .009(xt and are particularly v)-.15 F .009(aluable when used with control struc-)-.25 F(tures.)72 637.2 Q .583(There are se)97 652.8 R -.15(ve)-.25 G .583(ral shell).15 F F2 -.2(ex)3.083 G(pansions).2 E F0 5.583(.A)C -.25(va)254.298 652.8 S(riable).25 E F2(name)3.083E F0 .583(is e)3.083 F .582(xpanded to its v)-.15 F .582(alue using ${)-.25 FF2(name)A F0 .582(}, where)B 1.387(the braces are optional.)72 664.8 R 1.387(There are a number of parameter e)6.387 F 1.388(xpansions a)-.15 F -.25(va)-.2G 3.888(ilable. F).25 F 1.388(or e)-.15 F 1.388(xample, there are)-.15 F(${)72676.8 Q F2(name)A F0<3aad>A F2(wor)A(d)-.37 E F0 .891(}, which e)B .891(xpands to)-.15 F F2(wor)3.391 E(d)-.37 E F0(if)3.391 E F2(name)3.391 E F0 .891(is unset or null, and the in)3.391 F -.15(ve)-.4 G .89(rse ${).15 F F2(name)AF0(:+)A F2(wor)A(d)-.37 E F0 .89(}, which)B -.15(ex)72 688.8 S 1.203(pands to).15 F F2(wor)3.703 E(d)-.37 E F0(if)3.703 E F2(name)3.703 E F0 1.203(is set and not null.)3.703 F F2 1.203(Command substitution)6.203 F F0(allo)3.703 E 1.204(ws the output of a command to)-.25 F .918(replace the command name.)72 700.8 R .918(The syntax is `)5.918 F F2(command)AF0(`.)A F2(Command)5.918 E F0 .918(is e)3.418 F -.15(xe)-.15 G .918(cuted and it and the backquotes).15 F .299(are replaced by its output, with trailing ne)72 712.8 R .299(wlines remo)-.25F -.15(ve)-.15 G(d.).15 E F2 -.8(Pa)5.299 G .299(thname e).8 F(xpansion)-.2 EF0 .299(is a w)2.799 F .299(ay to e)-.1 F .299(xpand a w)-.15 F(ord)-.1 E 1.586(to a set of \214lenames.)72 724.8 R -.8(Wo)6.586 G 1.586(rds are re).8 F -.05(ga)-.15 G 1.586(rded as patterns, in which the characters).05 F F1(*)4.086 EF0(,)A F1(?)4.086 E F0 4.085(,a)C(nd)432.115 724.8 Q F1([)4.085 E F0(ha)4.085 E1.885 -.15(ve s)-.2 H(pecial).15 E EP%%Page: 3 3%%BeginPageSetupBP%%EndPageSetup/F0 10/Times-Roman@0 SF 2.5(-3-)279.67 48 S 2.845(meaning. W)72 84 R .346(ords\ containing these special characters are replaced with a sorted list of matchi\ng pathnames.)-.8 F(If a w)72 96 Q(ord generates no matches, it is left unchanged.)-.1 E/F1 10/Times-Italic@0 SF(Quoting)97 111.6 Q F0 .85(is used to remo)3.35 F 1.15 -.15(ve t)-.15 H .85
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -