⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ash.1

📁 操作系统设计与实现源码
💻 1
📖 第 1 页 / 共 5 页
字号:
1903(the)S2053(\256rst)S2237(line)S2415(of)S2526(the)S2676(program,)S3069(followed)S3454(by)S3581(the)S3731(name)S3976(of)S4087(the)S4236(program,)S4628(followed)S5012(by)S5138(the)S6024 V1080(arguments)S1524(passed)S1817(to)S1920(the)S2068(program.)S6264 V10 B(Redirection)505 864 A6432 V10 R(Input/output)496 1080 A1601(redirections)S2102(can)S2268(be)S2389(intermixed)S2851(with)S3056(the)S3205(words)S3477(in)S3581(a)S3652(simple)S3946(command)S4368(and)S4539(can)S4705(be)S(placed)263 4826 A5115(fol-)S6552 V1080(lowing)S1390(any)S1566(of)S1681(the)S1835(other)S2073(commands.)S2589(When)S2860(redirection)S3328(occurs,)S3646(the)S3799(shell)S4019(saves)S4267(the)S4420(old)S4578(values)S4865(of)S4979(the)S5132(\256le)S6672 V1080(descriptors)S1554(and)S1731(restores)S2077(them)S2310(when)S2560(the)S2715(command)S3143(completes.)S3633(The)S3822(``<'',)S4073(``>'',)S4324(and)S4502(``>>'')S4785(redirections)S6792 V1080(open)S1309(a)S1388(\256le)S1551(for)S(input,)231 1702 A1966(output,)S2280(and)S2458(appending,)S2934(respectively.)S3504(The)S3694(``<&digit'')S4182(and)S4360(``>&digit'')S4848(makes)S5138(the)S6912 V(input)206 1080 A1313(or)S1424(output)S1707(a)S(duplicate)369 1779 A2176(of)S2288(the)S2439(\256le)S2596(descriptor)S3027(numbered)S3457(by)S3585(the)S3736(digit.)S3998(If)S4094(a)S4167(minus)S4440(sign)S4635(is)S4730(used)S4942(in)S(place)213 5048 A7032 V1080(of)S1189(a)S1259(digit,)S1493(the)S1641(standard)S(input)206 2007 A2238(or)S2347(standard)S2713(output)S2994(are)S3143(closed.)S7200 V1080(The)S1265(``<<)S1472(word'')S1775(redirection)S2240(takes)S(input)206 2475 A2709(from)S2933(a)S10 I3007(here)S10 R3215(document.)S3690(As)S3831(the)S3983(shell)S(encounters)436 4202 A4667(``<<'')S4946(redirec-)S7320 V1080(tions,)S1337(it)S1430(collects)S1775(them.)S2063(The)S2257(next)S2467(time)S2682(it)S(encounters)436 2774 A3246(an)S3377(unescaped)S3832(newline,)S4212(it)S4304(reads)S4553(the)S4712(documents)S5183(in)S7440 V1080(turn.)S1321(The)S1507(word)S1743(following)S2163(the)S2315(``<<'')S2594(speci\256es)S2970(the)S3122(contents)S3486(of)S3599(the)S3752(line)S3933(that)S4114(terminates)S4564(the)S4717(document.)S5193(If)S7903 V720(Page)S941(3)S2654(\()S2696(March)S2984(7,)S(1991)200 3084 A3292(\))S4455(September)S4911(13,)S(1996)200 5061 A8143 VEP%%Page: 4 4BP/slant 0 def/height 0 def480 V10 R720(SH)S857(\()S899(1)S957(\))S2696(Eighth)S(Edition)296 2989 A4990(SH)S5127(\()S5169(1)S5227(\))S960 V(none)195 1080 A1303(of)S1415(the)S(quoting)306 1566 A(methods)340 1900 A(\('',)127 2268 A2423("",)S2558(or)S2670(\\\))S2760(are)S2912(used)S3124(to)S3230(enter)S3460(the)S3610(word,)S3869(then)S4069(the)S4219(document)S4642(is)S4736(treated)S5038(like)S5216(a)S1080 V1080(word)S1326(inside)S(double)273 1605 A(quotes:)290 1917 A2271(``$'')S2496(and)S(backquote)413 2680 A3132(are)S3295(expanded)S3719(and)S3904(backslash)S4335(can)S4515(be)S4650(used)S4874(to)S4992(escape)S1200 V1080(these)S1316(and)S1490(to)S1597(continue)S(long)178 1972 A2179(lines.)S2448(The)S2634(word)S(cannot)268 2870 A3167(contain)S3492(any)S3666(variable)S4020(or)S4132(command)S(substitutions,)532 4556 A5116(and)S1320 V1080(its)S1200(length)S1476(\(after)S(quoting\))340 1721 A2086(must)S2306(be)S2426(in)S2529(the)S2677(range)S2926(of)S3035(1)S3110(to)S3214(79)S3340(characters.)S3826(If)S(``<<-'')284 3920 A4230(is)S4323(used)S4533(in)S(place)213 4637 A4876(of)S4986(``<<'',)S1440 V1080(then)S1281(leading)S1605(tabs)S1795(are)S1947(deleted)S2266(from)S2490(the)S2641(lines)S2859(of)S2971(the)S3122(document.)S3596(\(This)S3837(is)S3932(to)S4038(allow)S(you)150 4290 A4468(do)S4596(indent)S4875(shell)S5093(pro-)S1560 V1080(cedures)S1413(containing)S1862(here)S2061(documents)S2521(in)S2624(a)S2694(natural)S2999(fashion.\))S1728 V1080(Any)S1301(of)S1433(the)S(preceding)397 1604 A2049(redirection)S2534(operators)S2957(may)S3178(be)S(preceded)364 3321 A3733(by)S3881(a)S3974(single)S4262(digit)S4494(specifying)S4961(the)S5132(\256le)S1848 V1080(descriptor)S1524(to)S1643(be)S1779(redirected.)S2274(There)S(cannot)268 2551 A2860(be)S2996(any)S3182(white)S(space)224 3447 A3712(between)S4089(the)S4252(digit)S4476(and)S4661(the)S4824(redirection)S1968 V1080(operator.)S2208 V10 B864(Path)S1091(Search)S2376 V10 R1080(When)S1351(locating)S1706(a)S1782(command,)S2234(the)S2388(shell)S2609(\256rst)S(looks)217 2797 A3045(to)S3154(see)S3314(if)S3407(it)S3494(has)S3659(a)S3735(shell)S3956(function)S4322(by)S4453(that)S4635(name.)S4935(Then,)S5199(if)S2496 V1080(PATH)S1370(does)S1580(not)S1734(contain)S2056(an)S2177(entry)S2410(for)S("%builtin",)453 2554 A3032(it)S(looks)217 3113 A3355(for)S3498(a)S(builtin)262 3568 A3855(command)S4276(by)S4401(that)S4577(name.)S4870(Finally,)S5205(it)S2616 V1080(searches)S(each)185 1447 A1657(entry)S1889(in)S1992(PATH)S2281(in)S2384(turn)S2571(for)S2714(the)S2862(command.)S2784 V1080(The)S1266(value)S1513(of)S1626(the)S1778(PATH)S2071(variable)S(should)267 2425 A2721(be)S2845(a)S2919(series)S3178(of)S3292(entries)S3591(separated)S4002(by)S4132(colons.)S4474(Each)S4706(entry)S4943(consists)S2904 V1080(of)S1192(a)S1265(directory)S1657(name,)S1928(or)S2040(a)S2113(directory)S2505(name)S2751(followed)S3137(by)S3265(a)S3338(\257ag)S3517(beginning)S3945(with)S4151(a)S4223(percent)S4547(sign.)S4791(The)S4975(current)S3024 V1080(directory)S(should)267 1469 A1761(be)S1881(indicated)S2275(by)S2400(an)S2520(empty)S2796(directory)S3185(name.)S3192 V1080(If)S1177(no)S1306(percent)S1632(sign)S1828(is)S1924(present,)S2269(then)S2471(the)S2623(entry)S2859(causes)S3151(the)S3303(shell)S3522(to)S3629(search)S3916(for)S4063(the)S4216(command)S4642(in)S4750(the)S4903(speci\256ed)S3312 V1080(directory.)S1528(If)S1630(the)S1787(\257ag)S1972(is)S(``%builtin'')482 2073 A2589(then)S2796(the)S2953(list)S3110(of)S3228(shell)S(builtin)262 3452 A3748(commands)S4217(is)S4317(searched.)S4753(If)S4854(the)S5010(\257ag)S5194(is)S3432 V1080(``%func'')S1511(then)S1716(the)S1871(directory)S2267(is)S2366(searched)S2751(for)S2901(a)S2978(\256le)S3139(which)S3417(is)S3517(read)S3724(as)S(input)206 3841 A4080(to)S4191(the)S4347(shell.)S4620(This)S4832(\256le)S(should)267 4994 A3552 V1080(de\256ne)S1351(a)S1421(function)S1781(whose)S2063(name)S2306(is)S2398(the)S2546(name)S2789(of)S2898(the)S3046(command)S3467(being)S3715(searched)S4093(for.)S3720 V1080(Command)S1523(names)S1805(containing)S2254(a)S2324(slash)S2550(are)S2699(simply)S2997(executed)S(without)307 3380 A3712(performing)S4190(any)S4360(of)S4469(the)S(above)240 4617 A4882(searches.)S3960 V10 B864(The)S1057(Environment)S4128 V10 R1080(The)S1266(environment)S1803(of)S1916(a)S1990(command)S2415(is)S2511(a)S2585(set)S2726(of)S2839(name/value)S3332(pairs.)S3607(When)S3877(the)S4030(shell)S4250(is)S(invoked,)348 4347 A4725(it)S4811(reads)S5054(these)S4248 V1080(names)S1366(and)S1540(values,)S1851(sets)S2031(the)S2183(shell)S2402(variables)S2794(with)S3001(these)S3236(names)S3521(to)S3627(the)S(corresponding)575 3778 A4381(values,)S4691(and)S4864(marks)S5138(the)S4368 V1080(variables)S1469(as)S(exported.)377 1578 A2005(The)S10 I2187(export)S10 R2469(command)S2890(can)S3055(be)S3175(used)S3384(to)S3487(mark)S(additional)402 3719 A4146(variables)S4535(as)S(exported.)377 4644 A4536 V1080(The)S1267(environment)S1805(of)S1919(a)S1995(command)S2422(is)S2520(constructed)S3015(by)S3146(constructing)S3674(name/value)S4169(pairs)S4396(from)S4623(all)S4755(the)S(exported)352 4909 A4656 V1080(shell)S1295(variables,)S1709(and)S1879(then)S2077(modifying)S2520(this)S2690(set)S2827(by)S2952(the)S3100(assignments)S3616(which)S(precede)314 3887 A4226(the)S4374(command,)S4820(if)S4907(any.)S4896 V10 B864(Expansion)S5064 V10 R1080(The)S1272(process)S1609(of)S1728(evaluating)S2182(words)S2463(when)S2716(a)S2796(shell)S3021(procedure)S3459(is)S3562(executed)S3956(is)S4059(called)S10 I(expansion)407 4336 A10 R4751(.)S4837(Expansion)S5184 V1080(consists)S1431(of)S1548(four)S1748(steps:)S2034(variable)S(substitution,)493 2391 A2916(command)S(substitution,)493 3344 A3869(word)S(splitting,)354 4108 A4494(and)S4671(\256le)S4832(name)S5082(gen-)S5304 V1080(eration.)S1442(If)S1542(a)S1619(word)S1858(is)S1957(the)S2112(expression)S2574(following)S2998(the)S3154(word)S10 B3394(case)S10 R3606(in)S3717(a)S3795(case)S4002(statement,)S4446(the)S4602(\256le)S4764(name)S5015(which)S5424 V1080(follows)S1408(a)S1479(redirection)S1942(symbol,)S2288(or)S2398(an)S2519(assignment)S2997(to)S3101(the)S3250(environment)S3784(of)S3894(a)S3965(command,)S4412(then)S4611(the)S4760(word)S(cannot)268 4993 A5544 V1080(be)S(split)173 1200 A1398(into)S(multiple)335 1579 A1939(words.)S2260(In)S2369(these)S2601(cases,)S2864(the)S3012(last)S3177(two)S3353(steps)S3579(of)S3688(the)S3836(expansion)S4268(process)S4595(are)S(omitted.)332 4744 A5784 V10 B864(Variable)S(Substitution)527 1264 A5952 V10 R1080(To)S1217(be)S(written.)311 1337 A6192 V10 B864(Command)S(Substitution)527 1342 A6360 V10 I1080(Ash)S10 R(accepts)297 1256 A1578(two)S1754(syntaxes)S2125(for)S2268(command)S(substitution:)496 2689 A6600 V1480(`)S10 I1514(list)S10 R1637(`)S6840 V1080(and)S7080 V1480($\()S10 I1564(list)S10 R1687(\))S7320 V1080(Either)S1362(of)S1481(these)S1723(may)S1931(be)S2061(included)S2442(in)S2555(a)S2635(word.)S2927(During)S3248(the)S3407(command)S(substitution)468 3839 A4343(process,)S4706(the)S4865(command)S7440 V1080(\(syntactly)S1507(a)S10 I1582(list)S10 R1713(\))S(will)157 1777 A1964(be)S2089(executed)S2477(and)S2652(anything)S3033(that)S3213(the)S3365(command)S3790(writes)S4066(to)S4173(the)S4325(standard)S4695(output)S(will)157 4980 A5166(be)S7903 V720(September)S1176(13,)S(1996)200 1326 A2654(\()S2696(March)S2984(7,)S(1991)200 3084 A3292(\))S4990(Page)S5211(4)S8143 VEP%%Page: 5 5BP/slant 0 def/height 0 def480 V10 R720(SH)S857(\()S899(1)S957(\))S2696(Eighth)S(Edition)296 2989 A4990(SH)S5127(\()S5169(1)S5227(\))S960 V1080(captured)S1452(by)S1577(the)S1726(shell.)S1992(The)S2175(\256nal)S2380(newline)S2725(\(if)S2847(any\))S3052(of)S3162(the)S3311(output)S(will)157 3593 A3776(be)S3897(deleted;)S4242(the)S4391(rest)S4563(of)S4673(the)S4822(output)S(will)157 5104 A1080 V1080(be)S(substituted)435 1200 A1660(for)S1803(the)S1951(command)S2372(in)S2475(the)S2623(word.)S1320 V10 B864(Word)S1140(Splitting)S1488 V10 R1080(When)S1350(the)S1503(value)S1751(of)S1865(a)S1940(variable)S2295(or)S2409(the)S2562(output)S2848(of)S2962(a)S3037(command)S3463(is)S(substituted,)460 3560 A4050(the)S(resulting)352 4204 A4587(text)S4769(is)S4867(subject)S5183(to)S1608 V1080(word)S(splitting,)354 1323 A1713(unless)S2000(the)S2159(dollar)S2430(sign)S(introducing)463 2633 A3132(the)S3291(variable)S3652(or)S(backquotes)452 3772 A4260(containing)S4720(the)S4878(text)S5064(were)S1728 V1080(enclosed)S1459(in)S(double)273 1564 A(quotes.)287 1864 A2203(In)S(addition,)354 2314 A2695(``$@'')S3001(is)S3095(subject)S3407(to)S3512(a)S3584(special)S3891(type)S4091(of)S(splitting,)354 4202 A4584(even)S4802(in)S4908(the)S5059(pres-)S1848 V1080(ence)S1290(of)S(double)273 1399 A(quotes.)287 1697 A2016 V1080(Ash)S1273(uses)S1477(two)S1659(different)S(splitting)329 2039 A2400(algorithms.)S2912(The)S3101(normal)S3418(approach,)S3844(which)S4122(is)S4221(intended)S4599(for)S(splitting)329 4749 A5110(text)S2136 V1080(separated)S1487(by)S1613(which)S(space,)249 1884 A2158(is)S2250(used)S2459(if)S2546(the)S2694(\256rst)S2876(character)S3272(of)S3381(the)S3529(shell)S3744(variable)S4094(IFS)S4265(is)S4357(a)S(space.)249 4427 A4726(Otherwise)S5166(an)S2256 V1080(alternative)S1537(experimental)S2094(algorithm,)S2541(which)S2818(is)S2916(useful)S3193(for)S(splitting)329 3343 A3704(\(possibly)S4104(empty\))S4421(\256elds)S4671(separated)S5084(by)S5216(a)S2376 V1080(separator)S1475(character,)S1896(is)S1988(used.)S2544 V1080(When)S1347(performing)S(splitting,)354 1827 A2208(the)S2358(shell)S2575(scans)S2820(the)S(replacement)493 2971 A3492(text)S(looking)306 3671 A4005(for)S4151(a)S4224(character)S4623(\(when)S4903(IFS)S5077(does)S2664 V1080(not)S1244(begin)S1503(with)S1718(a)S(space\))258 1799 A2093(or)S2213(a)S2294(sequence)S2699(of)S2819(characters)S3265(\(when)S3553(IFS)S3734(does)S3953(begin)S4211(with)S

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -