📄 readline_3.ps
字号:
72 112.8 Q/F2 10/Times-Bold@0 SF(#include <stdio.h>)108 124.8 Q(#include <r)108 136.8 Q(eadline/r)-.18 E(eadline.h>)-.18 E(#include <r)108 148.8 Q(eadline/history)-.18 E(.h>)-.7 E/F3 10/Times-Italic@0 SF-.15(ch)108 165.6 S(ar *).15 E F2 -.18(re)108 177.6 S(adline).18 E F0(\()2.5 E F3(const c)A(har *pr)-.15 E(ompt)-.45 E F0(\);)A F1(COPYRIGHT)72 194.4 Q F0(Readline is Cop)108 206.4 Q(yright \251 1989\2552004 by the Free Softw)-.1 E(are F)-.1 E(oundation, Inc.)-.15 E F1(DESCRIPTION)72 223.2 Q F2 -.18(re)108 235.2 S(adline).18 E F0 .088(will read a line from the terminal and return it, using)2.588 F F2(pr)2.587 E(ompt)-.18 E F0 .087(as a prompt.)2.587 F(If)5.087 E F2(pr)2.587E(ompt)-.18 E F0(is)2.587 E F2(NULL)2.587 E F0(or)2.587 E .42(the empty string, no prompt is issued.)108 247.2 R .421(The line returned is allocated with)5.42 F F3(malloc)2.921 E F0 .421(\(3\); the caller must free it).31 F(when \214nished.)108 259.2 Q(The line returned has the \214nal ne)5 E(wline remo)-.25 E -.15(ve)-.15G(d, so only the te).15 E(xt of the line remains.)-.15 E F2 -.18(re)108276 S(adline).18 E F0(of)3.79 E 1.29(fers editing capabilities while the user is entering the line.)-.25 F1.289(By def)6.289 F 1.289(ault, the line editing com-)-.1 F(mands are similar to those of emacs.)108 288 Q 2.5(Av)5 G(i\255style line editing interf)-2.5 E(ace is also a)-.1 E -.25(va)-.2 G(ilable.).25 E .272(This manual page describes only the most basic use of)108 304.8 R F2-.18(re)2.772 G(adline).18 E F0 5.272(.M)C .272(uch more functionality is a)-5.272 F -.25(va)-.2 G .272(ilable; see).25F F3(The GNU Readline Libr)108 316.8 Q(ary)-.15 E F0(and)2.5 E F3(The GNU History Libr)2.5 E(ary)-.15 E F0(for additional information.)2.5 E F1(RETURN V)72 333.6 Q(ALUE)-1.478 E F2 -.18(re)108 345.6 S(adline).18 E F0 1.09(returns the te)3.59 F 1.09(xt of the line read.)-.15 F 3.589(Ab)6.09 G 1.089(lank line returns the empty string.)-3.589F(If)6.089 E F2(EOF)3.589 E F0 1.089(is encountered)3.589 F .283(while reading a line, and the line is empty)108 357.6 R(,)-.65 E F2(NULL)2.783 E F0 .283(is returned.)2.783 F .283(If an)5.283 F F2(EOF)2.783 E F0 .283(is read with a non\255empty line, it)2.783 F(is treated as a ne)108 369.6 Q(wline.)-.25 E F1(NO)72 386.4 Q -.986(TA)-.438 G(TION)-.054 E F0 .181(An emacs-style notation is used to denote k)108 398.4 R -.15(ey)-.1 G(strok).15 E 2.681(es. Control)-.1 F -.1(ke)2.681 G .18(ys are denoted by C\255)-.05 F F3 -.1(ke)C(y)-.2 E F0 2.68(,e)C .18(.g., C\255n means)-2.68 F 2.582(Control\255N. Similarly)108 410.4 R(,)-.65 E F3(meta)2.962 E F0 -.1(ke)2.842 G .082(ys are denoted by M\255)-.05 F F3 -.1(ke)C(y)-.2 E F0 2.583(,s)C 2.583(oM)-2.583 G .083(\255x means Meta\255X.)-2.583 F .083(\(On k)5.083 F -.15(ey)-.1 G .083(boards without a).15 F F3(meta)108 422.4 Q F0 -.1(ke)3.491 G 2.031 -.65(y, M)-.05 H<ad>.65 E F3(x)A F0 .731(means ESC)3.231 F F3(x)3.231 E F03.231(,i)C .731(.e., press the Escape k)-3.231 F 1.03 -.15(ey t)-.1 H.73(hen the).15 F F3(x)4 E F0 -.1(ke)3.76 G 4.53 -.65(y. T)-.05 H .73(his mak).65 F .73(es ESC the)-.1 F F3 .73(meta pr)3.23 F(e\214x)-.37 EF0(.)A .48(The combination M\255C\255)108 434.4 R F3(x)A F0 .48(means ESC\255Control\255)2.98 F F3(x)A F0 2.98(,o)C 2.98(rp)-2.98 G .48(ress the Escape k)-2.98 F .78 -.15(ey t)-.1 H .48(hen hold the Control k).15 F .78 -.15(ey w)-.1 H(hile).15 E(pressing the)108 446.4 Q F3(x)3.27 E F0 -.1(ke)3.03 G -.65(y.)-.05 G(\)).65 E .62(Readline commands may be gi)108 463.2 R -.15(ve)-.25 G3.119(nn).15 G(umeric)-3.119 E F3(ar)3.119 E(guments)-.37 E F0 3.119(,w).27 G .619(hich normally act as a repeat count.)-3.119 F(Sometimes,)5.619 E(ho)108 475.2 Q(we)-.25 E -.15(ve)-.25 G 1.418 -.4(r, i).15 H3.118(ti).4 G 3.119(st)-3.118 G .619(he sign of the ar)-3.119 F .619(gument that is signi\214cant.)-.18 F -.15(Pa)5.619 G .619(ssing a ne).15 F -.05(ga)-.15 G(ti).05 E .919 -.15(ve a)-.25 H -.18(rg).15 G .619(ument to a command that).18 F 1.019(acts in the forw)108 487.2 R 1.018(ard direction \(e.g.,)-.1 F F2(kill\255line)3.518 E F0 3.518(\)c)C1.018(auses that command to act in a backw)-3.518 F 1.018(ard direction.)-.1 F(Com-)6.018 E(mands whose beha)108 499.2 Q(vior with ar)-.2 E(guments de)-.18 E(viates from this are noted.)-.25 E.811(When a command is described as)108 516 R F3(killing)3.311 E F0(te)3.311 E .811(xt, the te)-.15 F .811(xt deleted is sa)-.15 F -.15(ve)-.2G 3.311(df).15 G .812(or possible future retrie)-3.311 F -.25(va)-.25 G3.312(l\().25 G F3(yank-)-3.312 E(ing)108 528 Q F0 2.529(\). The)B .029(killed te)2.529 F .029(xt is sa)-.15 F -.15(ve)-.2 G 2.529(di).15 G2.529(na)-2.529 G F3 .029(kill ring)B F0 5.029(.C)C(onsecuti)-5.029 E.329 -.15(ve k)-.25 H .029(ills cause the te).15 F .029(xt to be accumulated into one unit,)-.15 F .567(which can be yank)108540 R .567(ed all at once.)-.1 F .567(Commands which do not kill te)5.567 F .567(xt separate the chunks of te)-.15 F .567(xt on the kill)-.15 F(ring.)108 552 Q F1(INITIALIZA)72 568.8 Q(TION FILE)-1.04 E F0.091(Readline is customized by putting commands in an initialization \\214le \(the)108 580.8 R F3(inputr)2.591 E(c)-.37 E F0 2.591(\214le\). The)2.591 F .091(name of this \214le)2.591 F 1.442(is tak)108592.8 R 1.443(en from the v)-.1 F 1.443(alue of the)-.25 F F2(INPUTRC)3.943 E F0(en)3.943 E 1.443(vironment v)-.4 F 3.943(ariable. If)-.25 F1.443(that v)3.943 F 1.443(ariable is unset, the def)-.25 F 1.443(ault is)-.1 F F3(~/.inputr)108 604.8 Q(c)-.37 E F0 5.359(.W).31 G .359(hen a program which uses the readline library starts up, the init \214\le is read, and the k)-5.359 F .658 -.15(ey b)-.1 H(ind-).15 E 1.083(ings and v)108 616.8 R 1.083(ariables are set.)-.25 F 1.083(There are only a fe)6.083 F 3.583(wb)-.25 G 1.083(asic constructs allo)-3.583 F 1.084(wed in the readline init \214le.)-.25 F(Blank)6.084 E.737(lines are ignored.)108 628.8 R .737(Lines be)5.737 F .737(ginning with a)-.15 F F2(#)3.237 E F0 .737(are comments.)3.237 F .737(Lines be)5.737 F .737(ginning with a)-.15 F F2($)3.237 E F0 .736(indicate conditional)3.236 F 2.614(constructs. Other)108 640.8 R .114(lines denote k)2.614 F .414 -.15(ey b)-.1 H .115(indings and v).15 F.115(ariable settings.)-.25 F .115(Each program using this library may add)5.115 F(its o)108 652.8 Q(wn commands and bindings.)-.25 E -.15(Fo)108 669.6 S 2.5(re).15 G(xample, placing)-2.65 E(M\255Control\255u: uni)144 686.4 Q -.15(ve)-.25G(rsal\255ar).15 E(gument)-.18 E(or)108 698.4 Q(C\255Meta\255u: uni)144710.4 Q -.15(ve)-.25 G(rsal\255ar).15 E(gument)-.18 E(GNU Readline 5.0)72 768 Q(2004 January 28)126.24 E(1)195.95 E 0 Cg EP%%Page: 2 2%%BeginPageSetupBP%%EndPageSetup/F0 10/Times-Roman@0 SF 342.2(READLINE\(3\) READLINE\(3\))72 48 R(into the)108 84 Q/F1 10/Times-Italic@0 SF(inputr)2.51 E(c)-.37 E F0 -.1(wo)2.81 G(uld mak).1 E 2.5(eM)-.1 G(\255C\255u e)-2.5 E -.15(xe)-.15 G(cute the readline command).15 E F1(univer)2.5 E(sal\255ar)-.1 E(gument)-.37 E F0(.).68 E 2.795(The follo)108 100.8 R 2.795(wing symbolic character names are recognized while processing k)-.25 F3.095 -.15(ey b)-.1 H(indings:).15 E F1(DEL)5.295 E F0(,).53 E F1(ESC)5.295 E F0(,).72 E F1(ESCAPE)108 112.8 Q F0(,).73 E F1(LFD)2.5 E F0(,).28 E F1(NEWLINE)2.5 E F0(,).73 E F1(RET)2.5 E F0(,)1.27 E F1(RETURN)2.5E F0(,)1.1 E F1 -.4(RU)2.5 G(BOUT).4 E F0(,)1.27 E F1(SP)2.5 E -.3(AC)-.9 G(E).3 E F0(,).73 E F1(SPC)2.5 E F0 2.5(,a).72 G(nd)-2.5 E F1 -.5(TA)2.5 G(B).5 E F0(.).27 E .209(In addition to command names, readline allo)108 129.6 R .209(ws k)-.25F -.15(ey)-.1 G 2.709(st).15 G 2.709(ob)-2.709 G 2.709(eb)-2.709 G .209(ound to a string that is inserted when the k)-2.709 F .509 -.15(ey i)-.1 H(s).15 E(pressed \(a)108 141.6 Q F1(macr)2.5 E(o)-.45 E F0(\).)A/F210/Times-Bold@0 SF -.25(Ke)87 163.2 S 2.5(yB).25 G(indings)-2.5 E F0.366(The syntax for controlling k)108 175.2 R .666 -.15(ey b)-.1 H .366(indings in the).15 F F1(inputr)2.876 E(c)-.37 E F0 .366(\214le is simple.)3.176 F .366(All that is required is the name of the)5.366 F .382(command or the te)108 187.2 R .383(xt of a macro and a k)-.15 F .683 -.15(ey s)-.1 H .383(equence to which it should be bound. The name may be speci-).15 F .853(\214ed in one of tw)108 199.2 R 3.353(ow)-.1 G .853(ays: as a symbolic k)-3.453 F 1.153 -.15(ey n)-.1 H .853(ame, possibly with).15 F F1(Meta\255)3.353 E F0(or)3.353 E F1(Contr)3.353 E(ol\255)-.45 E F0(pre\214x)3.353 E .853(es, or as a k)-.15 F -.15(ey)-.1 G(sequence.)108 211.2 Q 1.755(When using the form)108 228 R F2-.1(ke)4.255 G(yname).1 E F0(:)A F1(function-name).833 E F0(or)4.255 EF1(macr)4.255 E(o)-.45 E F0(,)A F1 -.1(ke)4.255 G(yname)-.2 E F0 1.756(is the name of a k)4.435 F 2.056 -.15(ey s)-.1 H 1.756(pelled out in).15 F 2.5(English. F)108 240 R(or e)-.15 E(xample:)-.15 E(Control\255u: uni)144 264 Q -.15(ve)-.25 G(rsal\255ar).15 E(gument)-.18E(Meta\255Rubout: backw)144 276 Q(ard\255kill\255w)-.1 E(ord)-.1 E(Control\255o: "> output")144 288 Q .148(In the abo)108 304.8 R .448-.15(ve ex)-.15 H(ample,).15 E F1(C\255u)2.488 E F0 .148(is bound to the function)2.898 F F2(uni)2.647 E -.1(ve)-.1 G(rsal\255ar).1 E(gument)-.1 E F0(,)A F1(M-DEL)3.327 E F0 .147(is bound to the function)3.177 F F2(backward\255kill\255w)108 316.8 Q(ord)-.1 E F0 3.835(,a)C(nd)-3.835 E F1(C\255o)3.675 E F0 1.336(is bound to run the macro e)4.016 F 1.336(xpressed on the right hand side \(that is, to)-.15 F(insert the te)108328.8 Q(xt)-.15 E/F3 10/Courier@0 SF 6(>o)2.5 G(utput)-6 E F0(into the line\).)2.5 E .056(In the second form,)108 345.6 R F2("k)2.556E(eyseq")-.1 E F0(:)A F1(function\255name).833 E F0(or)2.556 E F1(macr)2.556 E(o)-.45 E F0(,)A F2 -.1(ke)2.556 G(yseq).1 E F0(dif)2.555 E .055(fers from)-.25 F F2 -.1(ke)2.555 G(yname).1 E F0(abo)2.555 E .355 -.15(ve i)-.15 H 2.555(nt).15 G .055(hat strings)-2.555 F 1.284(denoting an entire k)108 357.6 R 1.584 -.15(ey s)-.1 H 1.284(equence m\ay be speci\214ed by placing the sequence within double quotes.).15 F(Some)6.284 E .386(GNU Emacs style k)108 369.6 R .686 -.15(ey e)-.1 H.385(scapes can be used, as in the follo).15 F .385(wing e)-.25 F .385(xample, b)-.15 F .385(ut the symbolic character names)-.2 F(are not recognized.)108 381.6 Q("\\C\255u": uni)144 405.6 Q -.15(ve)-.25 G(rsal\255ar).15 E(gument)-.18 E("\\C\255x\\C\255r": re\255read\255init\255\214le)144 417.6 Q("\\e[11~": "Function K)144 429.6 Q .3 -.15(ey 1)-.25 H(").15 E .198(In this e)108 446.4 R(xample,)-.15 E F1(C-u)2.538 E F0 .199(is ag)2.949F .199(ain bound to the function)-.05 F F2(uni)2.699 E -.1(ve)-.1 G(rsal\255ar).1 E(gument)-.1 E F0(.)A F1 .199(C-x C-r)5.039 F F0 .199(is bound to the function)3.429 F F2 -.18(re)108 458.4 S<ad72>.18 E(ead\255init\255\214le)-.18 E F0 2.5(,a)C(nd)-2.5 E F1(ESC [ 1 1 ~)3.01E F0(is bound to insert the te)3.94 E(xt)-.15 E F3(Function Key 1)2.5 EF0(.)A(The full set of GNU Emacs style escape sequences a)108 475.2 Q-.25(va)-.2 G(ilable when specifying k).25 E .3 -.15(ey s)-.1 H(equences is).15 E F2<5c43ad>144 487.2 Q F0(control pre\214x)20.3 E F2<5c4dad>144 499.2 Q F0(meta pre\214x)18.08 E F2(\\e)144 511.2 Q F0(an escape character)28.78 E F2(\\\\)144 523.2 Q F0(backslash)30.44 E F2(\\")144 535.2 Q F0(literal ", a double quote)27.67 E F2(\\')144 547.2 QF0(literal ', a single quote)29.89 E(In addition to the GNU Emacs style\ escape sequences, a second set of backslash escapes is a)108 564 Q -.25(va)-.2 G(ilable:).25 E F2(\\a)144 576 Q F0(alert \(bell\))28.22 E F2(\\b)144 588 Q F0(backspace)27.66 E F2(\\d)144 600 Q F0(delete)27.66 EF2(\\f)144 612 Q F0(form feed)29.89 E F2(\\n)144 624 Q F0(ne)27.66 E(wline)-.25 E F2(\\r)144 636 Q F0(carriage return)28.78 E F2(\\t)144 648Q F0(horizontal tab)29.89 E F2(\\v)144 660 Q F0 -.15(ve)28.22 G(rtical tab).15 E F2(\\)144 672 Q F1(nnn)A F0(the eight-bit character whose v)18.22 E(alue is the octal v)-.25 E(alue)-.25 E F1(nnn)2.5 E F0(\(one to three digits\))2.5 E F2(\\x)144684 Q F1(HH)A F0(the eight-bit character whose v)13.78 E(alue is the he)-.25 E(xadecimal v)-.15 E(alue)-.25 E F1(HH)2.5 E F0(\(one or tw)2.5 E2.5(oh)-.1 G .3 -.15(ex d)-2.5 H(igits\)).15 E .74(When entering the te)108 700.8 R .74(xt of a macro, single or double quotes should be used t\o indicate a macro de\214nition.)-.15 F .089(Unquoted te)108 712.8 R.089(xt is assumed to be a function name.)-.15 F .09(In the macro body)5.089 F 2.59(,t)-.65 G .09(he backslash escapes described abo)-2.59 F-.15(ve)-.15 G(are e)108 724.8 Q 2.5(xpanded. Backslash)-.15 F(will quote an)2.5 E 2.5(yo)-.15 G(ther character in the macro te)-2.5 E(xt, including " and '.)-.15 E(GNU Readline 5.0)72 768 Q(2004 January 28)126.24 E(2)195.95 E 0 Cg EP%%Page: 3 3%%BeginPageSetupBP%%EndPageSetup/F0 10/Times-Roman@0 SF 342.2(READLINE\(3\) READLINE\(3\))72 48 R/F1 10/Times-Bold@0 SF(Bash)108 84 Q F0(allo)2.93 E .43(ws the current readline k)-.25 F .73 -.15(ey b)-.1 H .429(indings to be displayed or modi\214ed with the).15 F F1(bind)2.929 E F0-.2(bu)2.929 G .429(iltin command.).2 F 1.095(The editing mode may be switched during interacti)108 96 R 1.395 -.15(ve u)-.25 H 1.095(se by using the).15 F F1<ad6f>3.595 E F0 1.095(option to the)3.595 F F1(set)3.595 E F0 -.2(bu)3.595 G 1.095(iltin com-).2 F 3.076(mand. Other)108 108 R .576(programs using this library pro)3.076 F .575(vide similar mechanisms.)-.15 F(The)5.575 E/F2 10/Times-Italic@0 SF(inputr)3.085 E(c)-.37 E F0.575(\214le may be edited and)3.385 F(re-read if a program does not pro)108 120 Q(vide an)-.15 E 2.5(yo)-.15 G(ther means to incorporate ne)-2.5E 2.5(wb)-.25 G(indings.)-2.5 E F1 -.92(Va)87 136.8 S(riables).92 E F0.043(Readline has v)108 148.8 R .043(ariables that can be used to further customize its beha)-.25 F(vior)-.2E 5.043(.A)-.55 G -.25(va)-2.5 G .043(riable may be set in the).25 F F2(inpu-)2.554 E(tr)108 160.8 Q(c)-.37 E F0(\214le with a statement of the form)2.81 E F1(set)144 177.6 Q F2(variable\255name value)2.5 E F0 .807(Except where noted, readline v)108194.4 R .807(ariables can tak)-.25 F 3.307(et)-.1 G .807(he v)-3.307 F(alues)-.25 E F1(On)3.307 E F0(or)3.307 E F1(Off)3.307 E F0 .807(\(without re)3.307 F -.05(ga)-.15 G .807(rd to case\).).05 F .807(The v)5.807 F(ari-)-.25 E(ables and their def)108 206.4 Q(ault v)-.1 E(alues are:)-.25 E F1(bell\255style \(audible\))108 223.2 Q F0 .01(Controls what happens when readline w)144 235.2 R .011(ants to ring the terminal bell.)-.1 F .011(If set to)5.011 F F1(none)2.511 E F0 2.511(,r)C .011(eadline ne)-2.511 F -.15(ve)-.25 G(r).15 E.94(rings the bell.)144 247.2 R .94(If set to)5.94 F F1(visible)3.44 EF0 3.44(,r)C .94(eadline uses a visible bell if one is a)-3.44 F -.25(va)-.2 G 3.44(ilable. If).25 F .94(set to)3.44 F F1(audible)3.44 E F0(,)A(readline attempts to ring the terminal')144 259.2 Q 2.5(sb)-.55 G(ell.)-2.5 E F1(comment\255begin \(`)108 271.2 Q(`#')-.63 E('\))-.63 EF0 .062(The string that is inserted in)144 283.2 R F1(vi)2.562 E F0 .062(mode when the)2.562 F F1(insert\255comment)2.562 E F0 .062
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -