📄 bash.ps
字号:
.917(ersions of)-.15 F F1(sh)3.417 E F0(as)3.417 E .145(closely as possible, while conforming to the POSIX standard as well.)108 96 R .145(When in)5.145 F -.2(vo)-.4 G -.1(ke).2 G 2.645(da).1 G2.645(sa)-2.645 G 2.645(ni)-2.645 G(nteracti)-2.645 E .445 -.15(ve l)-.25 H(ogin).15 E 1.264(shell, or a non-interacti)108 108 R 1.564 -.15(ve s)-.25 H 1.264(hell with the).15 F F1(\255\255login)3.764 E F0 1.264(option, it \214rst attempts to read and e)3.764 F -.15(xe)-.15 G 1.263(cute commands).15 F(from)108 120 Q/F2 10/Times-Italic@0 SF(/etc/pr)4.142 E(o\214le)-.45 E F0(and)3.172 E F2(~/.pr)2.992 E(o\214le)-.45 E F02.992(,i).18 G 2.992(nt)-2.992 G .492(hat order)-2.992 F 5.492(.T)-.55 G(he)-5.492 E F1(\255\255nopr)2.992 E(o\214le)-.18 E F0 .493(option may be used to inhibit this beha)2.993 F(vior)-.2 E(.)-.55 E.418(When in)108 132 R -.2(vo)-.4 G -.1(ke).2 G 2.918(da).1 G 2.918(sa)-2.918 G 2.918(ni)-2.918 G(nteracti)-2.918 E .718 -.15(ve s)-.25 H .418(hell with the name).15 F F1(sh)2.918 E F0(,)A F1(bash)2.918 E F0 .418(looks for the v)2.918 F(ariable)-.25 E/F3 9/Times-Bold@0 SF(ENV)2.918 E/F4 9/Times-Roman@0 SF(,)A F0 -.15(ex)2.667 G .417(pands its v).15 F(alue)-.25 E .171(if it is de\214ned, and uses the e)108 144 R .171(xpanded v)-.15 F .171(alue as the name of a \214le to read and e)-.25 F-.15(xe)-.15 G 2.671(cute. Since).15 F 2.671(as)2.671 G .171(hell in)-2.671 F -.2(vo)-.4 G -.1(ke).2 G(d).1 E(as)108 156 Q F1(sh)3.081 E F0.581(does not attempt to read and e)3.081 F -.15(xe)-.15 G .581(cute commands from an).15 F 3.08(yo)-.15 G .58(ther startup \214les, the)-3.08 F F1<adad72>3.08 E(c\214le)-.18 E F0.58(option has)3.08 F .182(no ef)108 168 R 2.682(fect. A)-.25 F(non-interacti)2.682 E .482 -.15(ve s)-.25 H .182(hell in).15 F -.2(vo)-.4 G -.1(ke).2 G 2.682(dw).1 G .182(ith the name)-2.682 F F1(sh)2.682 EF0 .182(does not attempt to read an)2.682 F 2.683(yo)-.15 G .183(ther startup \214les.)-2.683 F(When in)108 180 Q -.2(vo)-.4 G -.1(ke).2G 2.5(da).1 G(s)-2.5 E F1(sh)2.5 E F0(,)A F1(bash)2.5 E F0(enters)2.5 EF2(posix)3.75 E F0(mode after the startup \214les are read.)3.03 E(When)108 196.8 Q F1(bash)2.727 E F0 .226(is started in)2.727 F F2(posix)3.976E F0 .226(mode, as with the)3.256 F F1(\255\255posix)2.726 E F0 .226(command line option, it follo)2.726 F .226(ws the POSIX stan-)-.25 F.341(dard for startup \214les.)108 208.8 R .341(In this mode, interacti)5.341 F .641 -.15(ve s)-.25 H .341(hells e).15 F .341(xpand the)-.15 FF3(ENV)2.841 E F0 -.25(va)2.591 G .342(riable and commands are read and).25 F -.15(exe)108 220.8 S(cuted from the \214le whose name is the e).15E(xpanded v)-.15 E 2.5(alue. No)-.25 F(other startup \214les are read.)2.5 E F1(Bash)108 237.6 Q F0 .224(attempts to determine when it is bein\g run with its standard input connected to a netw)2.724 F .223(ork connection,)-.1 F .025(as when e)108 249.6 R -.15(xe)-.15 G .025(cuted by the remote shell daemon, usually).15 F F2 -.1(rs)2.525 G(hd).1E F0 2.525(,o)C 2.525(rt)-2.525 G .025(he secure shell daemon)-2.525 FF2(sshd)2.525 E F0 5.025(.I)C(f)-5.025 E F1(bash)2.525 E F0(deter)2.525E(-)-.2 E .134(mines it is being run in this f)108 261.6 R .134(ashion, it reads and e)-.1 F -.15(xe)-.15 G .133(cutes commands from).15 F F2(~/.bashr)2.633 E(c)-.37 E F0 2.633(,i)C 2.633(ft)-2.633 G .133(hat \214le e)-2.633 F .133(xists and is)-.15 F 2.869(readable. It)108273.6 R .369(will not do this if in)2.869 F -.2(vo)-.4 G -.1(ke).2 G2.869(da).1 G(s)-2.869 E F1(sh)2.869 E F0 5.369(.T)C(he)-5.369 E F1<adad6e6f72>2.869 E(c)-.18 E F0 .369(option may be used to inhibit this beha)2.869 F(vior)-.2 E 2.869(,a)-.4G(nd)-2.869 E(the)108 285.6 Q F1<adad72>2.606 E(c\214le)-.18 E F0 .106(option may be used to force another \214le to be read, b)2.606 F(ut)-.2E F2 -.1(rs)2.606 G(hd).1 E F0 .106(does not generally in)2.606 F -.2(vo)-.4 G .306 -.1(ke t).2 H .106(he shell).1 F(with those options or allo)108 297.6 Q 2.5(wt)-.25 G(hem to be speci\214ed.)-2.5 E 1.207(If the shell is started with the ef)108 314.4 R(fecti)-.25 E 1.507 -.15(ve u)-.25 H 1.208(ser \(group\) id not equal to the real user \(group\) id, and the).15 FF1<ad70>3.708 E F0 .536(option is not supplied, no startup \214les are \read, shell functions are not inherited from the en)108 326.4 R .535(vironment, the)-.4 F F3(SHELLOPTS)108 338.4 Q F4(,)A F3 -.27(BA)2.959 G(SHOPTS).27 E F4(,)A F3(CDP)2.959 E -.855(AT)-.666 G(H).855 E F4(,)A F0(and)2.959 E F3(GLOBIGNORE)3.209 E F0 -.25(va)2.959 G .709(riables, if the).25 F 3.209(ya)-.15 G .71(ppear in the en)-3.209 F .71(vironment, are)-.4 F .905(ignored, and the ef)108 350.4 R(fecti)-.25 E1.205 -.15(ve u)-.25 H .904(ser id is set to the real user id.).15 F.904(If the)5.904 F F1<ad70>3.404 E F0 .904(option is supplied at in)3.404 F -.2(vo)-.4 G .904(cation, the).2 F(startup beha)108 362.4 Q(vior is the same, b)-.2 E(ut the ef)-.2 E(fecti)-.25 E .3 -.15(ve u)-.25 H(ser id is not reset.).15 E/F5 10.95/Times-Bold@0 SF(DEFINITIONS)72 379.2 Q F0(The follo)108 391.2 Q(wing de\214nitions are used throughout the rest of this document.)-.25E F1(blank)108 403.2 Q F0 2.5(As)11.54 G(pace or tab)-2.5 E(.)-.4 E F1-.1(wo)108 415.2 S(rd).1 E F0 2.5(As)13.88 G(equence of characters considered as a single unit by the shell.)-2.5 E(Also kno)5 E(wn as a)-.25 E F1(tok)2.5 E(en)-.1 E F0(.)A F1(name)108427.2 Q F0(A)12.67 E F2(wor)3.005 E(d)-.37 E F0 .165(consisting only of alphanumeric characters and underscores, and be)3.435 F .166(ginning with an alpha-)-.15 F(betic character or an underscore.)144 439.2 Q(Also referred to as an)5E F1(identi\214er)2.5 E F0(.)A F1(metacharacter)108 451.2 Q F0 2.5(Ac)144 463.2 S(haracter that, when unquoted, separates w)-2.5 E 2.5(ords. One)-.1 F(of the follo)2.5 E(wing:)-.25 E F1 5(|&;\(\)<>s)144475.2 S 2.5(pace tab)-5 F(contr)108 487.2 Q(ol operator)-.18 E F0(A)144499.2 Q F2(tok)2.5 E(en)-.1 E F0(that performs a control function.)2.5 E(It is one of the follo)5 E(wing symbols:)-.25 E F1 2.5(|| & && ; ;; \( \) | |&)144 511.2 R(<newline>)10 E F5(RESER)72 528 Q(VED W)-.602 E(ORDS)-.11 E F2 .307(Reserved wor)108 540 R(ds)-.37 E F0.307(are w)2.807 F .307(ords that ha)-.1 F .607 -.15(ve a s)-.2 H .306(pecial meaning to the shell.).15 F .306(The follo)5.306 F .306(wing w)-.25 F .306(ords are recognized as)-.1 F(reserv)108 552 Q .227(ed when unquoted and either the \214rst w)-.15 F .227(ord of a simple command \(see)-.1 F F3 .227(SHELL GRAMMAR)2.727 F F0(belo)2.477 E .227(w\) or)-.25 F(the third w)108 564 Q(ord of a)-.1 E F1(case)2.5 E F0(or)2.5 E F1 -.25(fo)2.5 G(r).25 E F0(command:)2.5 E F111.916(!c)144 580.8 S 9.416(ase do done elif else esac \214 f)-11.916 F9.415(or function if in select then until)-.25 F 7.5(while { } time [[ ]])144 592.8 R F5(SHELL GRAMMAR)72 609.6 Q F1(Simple Commands)87 621.6 Q F0(A)108 633.6 Q F2 .388(simple command)2.888 F F0 .388(is a sequence of optional v)2.888 F .389(ariable assignments follo)-.25 F .389(wed by)-.25 F F1(blank)2.889 E F0.389(-separated w)B .389(ords and)-.1 F .816(redirections, and terminated by a)108 645.6 R F2(contr)3.316 E .815(ol oper)-.45 F(ator)-.15 E F0 5.815(.T)C .815(he \214rst w)-5.815 F.815(ord speci\214es the command to be e)-.1 F -.15(xe)-.15 G(cuted,).15E(and is passed as ar)108 657.6 Q(gument zero.)-.18 E(The remaining w)5E(ords are passed as ar)-.1 E(guments to the in)-.18 E -.2(vo)-.4 G -.1(ke).2 G 2.5(dc).1 G(ommand.)-2.5 E .175(The return v)108 674.4 R .175(alue of a)-.25 F F2 .175(simple command)2.675 F F0 .175(is its e)2.675F .175(xit status, or 128+)-.15 F F2(n)A F0 .176(if the command is terminated by signal)3.508 F F2(n)2.676 E F0(.).24 EF1(Pipelines)87 691.2 Q F0(A)108 703.2 Q F2(pipeline)2.996 E F0 .496(is\ a sequence of one or more commands separated by one of the control ope\rators)2.996 F F1(|)2.996 E F0(or)2.996 E F1(|&)2.996 E F0 5.496(.T)C(he)-5.496 E(format for a pipeline is:)108 715.2 Q(GNU Bash-4.2)72 768 Q(2010 December 28)135.965 E(3)190.955 E 0 Cg EP%%Page: 4 4%%BeginPageSetupBP%%EndPageSetup/F0 10/Times-Roman@0 SF -.35(BA)72 48 S 389.54(SH\(1\) B).35 F(ASH\(1\))-.35 E([)144 84 Q/F1 10/Times-Bold@0 SF(time)A F0([)2.5 E F1<ad70>A F0(]] [ ! ])A/F2 10/Times-Italic@0 SF(command)2.5 E F0 2.5([[)2.5 G F1(|)-2.5 E/F3 10/Symbol SF<ef>A F1(|&)A F0(])A F2(command2)2.5 E F0(... ])2.5 E .243(The standard output of)108 100.8 R F2(command)2.943 E F0 .244(is connected via a pipe to the standard input of)3.513 F F2(command2)2.744 E F0 5.244(.T).02 G .244(his connec-)-5.244 F .643(tion is performed before an)108 112.8 R 3.143(yr)-.15 G .642(edirections speci\214ed by the command \(see)-3.143 F/F4 9/Times-Bold@0SF(REDIRECTION)3.142 E F0(belo)2.892 E 3.142(w\). If)-.25 F F1(|&)3.142E F0(is)3.142 E 1.43(used, the standard error of)108 124.8 R F2(command)3.93 E F0 1.431(is connected to)3.93 F F2(command2)3.931 E F0 2.531 -.55('s s)D 1.431(tandard input through the pipe; it is).55 F 1.197(shorthand for)108 136.8 R F1 1.197(2>&1 |)3.697 F F0 6.197(.T)C 1.197(his implicit redirection of the standard error is performed after an)-6.197 F 3.696(yr)-.15 G(edirections)-3.696 E(speci\214ed by the command.)108 148.8 Q .48(The return status of a pipeline is the e)108 165.6 R .48(xit status of the last command, unless the)-.15 F F1(pipefail)2.98 E F0.48(option is enabled.)2.98 F(If)108 177.6 Q F1(pipefail)2.687 E F0 .187(is enabled, the pipeline')2.687 F 2.687(sr)-.55 G .186(eturn status is the v)-2.687 F .186(alue of the last \(rightmost\) command to e)-.25 F .186(xit with a)-.15F .61(non-zero status, or zero if all commands e)108 189.6 R .611(xit successfully)-.15 F 5.611(.I)-.65 G 3.111(ft)-5.611 G .611(he reserv)-3.111 F .611(ed w)-.15 F(ord)-.1 E F1(!)3.111 E F0 .611(precedes a pipeline, the)5.611 F -.15(ex)108 201.6 S .55(it status of that pipeline is the logical ne).15 F -.05(ga)-.15 G .55(tion of the e).05 F .55(xit status as described abo)-.15 F -.15(ve)-.15G 5.55(.T).15 G .55(he shell w)-5.55 F .55(aits for)-.1 F(all commands in the pipeline to terminate before returning a v)108213.6 Q(alue.)-.25 E .298(If the)108 230.4 R F1(time)2.799 E F0(reserv)2.799 E .299(ed w)-.15 F .299(ord precedes a pipeline, the elapsed as w\ell as user and system time consumed by its)-.1 F -.15(exe)108 242.4 S.14(cution are reported when the pipeline terminates.).15 F(The)5.139 EF1<ad70>2.639 E F0 .139(option changes the output format to that spec-)2.639 F .302(i\214ed by POSIX.)108 254.4 R .303(When the shell is in)5.302 F F2 .303(posix mode)2.803 F F0 2.803(,i)C 2.803(td)-2.803 G .303(oes not recognize)-2.803 F F1(time)2.803 E F0 .303(as a reserv)2.803 F.303(ed w)-.15 F .303(ord if the ne)-.1 F(xt)-.15 E(tok)108 266.4 Q .736(en be)-.1 F .736(gins with a `-'.)-.15 F(The)5.736 E F4(TIMEFORMA)3.236E(T)-.855 E F0 -.25(va)2.986 G .736(riable may be set to a format string that speci\214es ho).25 F 3.235(wt)-.25 G(he)-3.235 E 2.225(timing information should be displayed; see the description of)108278.4 R F4(TIMEFORMA)4.726 E(T)-.855 E F0(under)4.476 E F1 2.226(Shell V)4.726 F(ariables)-.92 E F0(belo)108 290.4 Q -.65(w.)-.25 G .85(When the shell is in)108 307.2 R F2 .85(posix mode)3.35 F F0(,)A F1(time)3.35 E F0 .85(may be follo)3.35 F .85(wed by a ne)-.25 F 3.35(wline. In)-.25 F .85(this case, the shell displays the)3.35 F 1.073(total user and system time consumed by the shell and its children.)108319.2 R(The)6.074 E F4(TIMEFORMA)3.574 E(T)-.855 E F0 -.25(va)3.324 G1.074(riable may be).25 F(used to specify the format of the time information.)108 331.2 Q(Each command in a pipeline is e)108 348 Q -.15(xe)-.15 G(cuted as a separate process \(i.e., in a subshell\).).15 E F1(Lists)87364.8 Q F0(A)108 376.8 Q F2(list)2.85 E F0 .35(is a sequence of one or \more pipelines separated by one of the operators)2.85 F F1(;)2.849 E F0(,)A F1(&)2.849 E F0(,)A F1(&&)2.849 E F0 2.849(,o)C(r)-2.849 E F1(||)2.849 E F0 2.849(,a)C .349(nd option-)-2.849 F(ally terminated by one of)108 388.8 Q F1(;)2.5 E F0(,)A F1(&)2.5 E F02.5(,o)C(r)-2.5 E F1(<newline>)2.5 E F0(.)A .96(Of these list operators,)108 405.6 R F1(&&)3.46 E F0(and)3.46 E F1(||)3.46 E F0(ha)3.46 E 1.26 -.15(ve e)-.2 H .961(qual precedence, follo).15F .961(wed by)-.25 F F1(;)3.461 E F0(and)3.461 E F1(&)3.461 E F0 3.461(,w)C .961(hich ha)-3.461 F 1.261 -.15(ve e)-.2 H .961(qual prece-).15 F(dence.)108 417.6 Q 2.5(As)108 434.4 S(equence of one or more ne)-2.5 E(wlines may appear in a)-.25 E F2(list)2.5 E F0(instead of a semicolon to delimit commands.)2.5 E .029(If a command is terminated by the control operator)108 451.2 R F1(&)2.529 E F0 2.529(,t)C .029(he shell e)-2.529 F -.15(xe)-.15 G .029(cutes the command in the).15 F F2(bac)2.528 E(kgr)-.2 E(ound)-.45 E F0(in)2.528 E 2.875(as)108 463.2 S 2.875(ubshell. The)-2.875 F .375(shell does not w)2.875 F .375(ait for the command to \214nish, and the return status is 0.)-.1 F .376(Commands sepa-)5.376 F .849(rated by a)108 475.2 R F1(;)3.349 E F0 .849(are e)3.349 F -.15(xe)-.15 G .848(cuted sequentially; the shell w).15 F.848(aits for each command to terminate in turn.)-.1 F .848(The return)5.848 F(status is the e)108 487.2 Q(xit status of the last command e)-.15 E -.15(xe)-.15 G(cuted.).15 E .937(AND and OR lists are sequences \of one of more pipelines separated by the)108 504 R F1(&&)3.437 E F0(and)3.437 E F1(||)3.437 E F0 .937(control operators,)3.437 F(respecti)108 516 Q -.15(ve)-.25 G(ly).15 E 5(.A)-.65 G(ND and OR lists are e)-5 E-.15(xe)-.15 G(cuted with left associati).15 E(vity)-.25 E 5(.A)-.65 G2.5(nA)-5 G(ND list has the form)-2.5 E F2(command1)144 532.8 Q F1(&&)2.5 E F2(command2)2.5 E(command2)108.2 549.6 Q F0(is e)2.52 E -.15(xe)-.15 G(cuted if, and only if,).15 E F2(command1)2.7 E F0(returns an e)2.5 E(xit status of zero.)-.15 E(An OR list has the form)108 566.4 Q F2(command1)144 583.2 Q F1(||)2.5 E F2(command2)2.5 E(command2)108.2 604.8Q F0 .729(is e)3.249 F -.15(xe)-.15 G .729(cuted if and only if).15 F F2(command1)3.429 E F0 .729(returns a non-zero e)3.229 F .729(xit status.)-.15 F .728(The return status of AND)5.729 F(and OR lists is the e)108616.8 Q(xit status of the last command e)-.15 E -.15(xe)-.15 G(cuted in the list.).15 E F1(Compound Commands)87 633.6 Q F0(A)108 645.6Q F2(compound command)2.5 E F0(is one of the follo)2.5 E(wing:)-.25 E(\()108 662.4 Q F2(list)A F0(\))A F2(list)17.11 E F0 .011(is e)2.511 F-.15(xe)-.15 G .011(cuted in a subshell en).15 F .011(vironment \(see)-.4 F F4 .011(COMMAND EXECUTION ENVIR)2.511 F(ONMENT)-.27 E F0(belo)2.262 E(w\).)-.25 E -1.11(Va)144 674.4 S 1.064(riable assignments and b)1.11 F 1.064(uiltin commands that af)-.2 F 1.064(fect the shell')-.25 F3.564(se)-.55 G -.4(nv)-3.564 G 1.064(ironment do not remain in).4 F(ef)144 686.4 Q(fect after the command completes.)-.25 E(The return status is the e)5 E(xit status of)-.15 E F2(list)2.5 E F0(.)A({)108 703.2 Q F2(list)2.5 E F0 2.5(;})C F2(list)3.89 E F0 .401(is simply e)2.901 F -.15(xe)-.15 G .401(cuted in the current shell en).15 F(vironment.)-.4 E F2(list)5.401 E F0 .402(must be terminated with a ne)2.901 F .402(wline or)-.25 F 3.215(semicolon. This)144 715.2 R .715(is kno)3.215 F .715(wn as a)-.25 F F2
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -