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

📄 ash.1

📁 操作系统设计与实现源码
💻 1
📖 第 1 页 / 共 5 页
字号:
1080(case,)S1311(typing)S1599(the)S1754(suspend)S2109(character)S2512(\(typically)S2930(\303Z\))S3092(while)S(running)312 3348 A3692(a)S3769(command)S(will)157 4196 A4384(return)S(you)150 4656 A4837(to)S10 I4946(ash)S10 R5116(and)S5160 V(will)157 1080 A1269(make)S1519(the)S1674(suspended)S2124(command)S2553(the)S2709(current)S3028(job.)S3239(You)S3445(can)S3618(then)S3824(continue)S4203(the)S4359(job)S4520(in)S4631(the)S(background)474 4787 A5280 V1080(by)S1205(typing)S10 I1486(bg)S10 R1594(,)S1644(or)S(you)150 1753 A1928(can)S2093(continue)S2464(it)S2545(in)S2648(the)S(foreground)447 2796 A3268(by)S3393(typing)S10 I3674(fg)S10 R3760(.)S5520 V10 B864(Atty)S5688 V10 R1080(If)S1182(the)S1339(shell)S1563(variable)S1922(ATTY)S2226(is)S2327(set,)S2498(and)S2677(the)S2834(shell)S3058(variable)S3417(TERM)S3731(is)S3832(not)S3994(set)S4140(to)S4252(``emacs'',)S4700(then)S10 I4908(ash)S10 R5082(gen-)S5808 V1080(erates)S1341(appropriate)S1825(escape)S2119(sequences)S2552(to)S2655(talk)S2831(to)S10 I2934(atty)S10 R3093(\(1\).)S6048 V10 B864(Exit)S1068(Statuses)S6216 V10 R1080(By)S(tradition,)366 1223 A1615(an)S1737(exit)S1915(status)S2171(of)S2282(zero)S2483(means)S2767(that)S2945(a)S3017(command)S3440(has)S(succeeded)414 3601 A4042(and)S4214(a)S(nonzero)324 4286 A4637(exit)S4815(status)S5071(indi-)S6336 V1080(cates)S1315(that)S1499(the)S1655(command)S2084(failed.)S2397(This)S2609(is)S2709(better)S2971(than)S3176(no)S(convention)446 3308 A3786(at)S3891(all,)S4049(but)S4209(in)S4319(practice)S4671(it)S4759(is)S4858(extremely)S6456 V1080(useful)S1365(to)S1482(allow)S1745(commands)S2219(that)S(succeed)319 2409 A2767(to)S2884(use)S3057(the)S3219(exit)S3409(status)S3678(to)S3796(return)S4077(information)S4592(to)S4710(the)S4873(caller.)S5188(A)S6576 V1080(variety)S1395(of)S1513(better)S(conventions)485 1777 A2296(have)S2520(been)S(proposed,)393 2744 A3171(but)S(none)195 3333 A3562(of)S3680(them)S3915(has)S4083(met)S4268(with)S4481(universal)S4884(approval.)S6696 V1080(The)S(convention)446 1262 A1733(used)S1942(by)S10 I2067(ash)S10 R2231(and)S2401(all)S2527(the)S2675(programs)S3080(included)S3451(in)S3554(the)S10 I3702(ash)S10 R3866(distribution)S4354(is)S4446(as)S4555(follows:)S6816 V1800(0)S(Success.)344 2520 A6936 V1800(1)S2520(Alternate)S(success.)327 2921 A7056 V1800(2)S2520(Failure.)S7176 V(129-...)259 1800 A2520(Command)S2963(terminated)S3419(by)S3544(a)S3614(signal.)S7296 V1080(The)S10 I1269(alternate)S(success)302 1664 A10 R1998(return)S2271(is)S2370(used)S2586(by)S2718(commands)S3185(to)S3296(indicate)S3648(various)S(conditions)418 3977 A4428(which)S4707(are)S4864(not)S5025(errors)S7416 V1080(but)S1248(which)S1534(can,)S1738(with)S1956(a)S(little)185 2040 A2264(imagination,)S2808(be)S2942(conceived)S3389(of)S3512(as)S3635(less)S(successful)414 3825 A4278(than)S4490(plain)S(success.)327 4730 A5121(For)S7536 V1080(example,)S10 I1474(test)S10 R1642(returns)S1950(1)S2028(when)S2274(the)S2425(tested)S(condition)379 2689 A3097(is)S3193(false)S3413(and)S10 I3587(getopts)S10 R3906(returns)S4215(1)S4294(when)S4541(there)S4772(are)S4925(no)S5054(more)S7903 V720(September)S1176(13,)S(1996)200 1326 A2654(\()S2696(March)S2984(7,)S(1991)200 3084 A3292(\))S4990(Page)S5211(6)S8143 VEP%%Page: 7 7BP/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(options.)S(Because)336 1459 A1829(this)S(convention)446 2008 A2488(is)S2589(not)S2751(used)S2969(universally,)S3475(the)S10 B3632(-e)S10 R3745(option)S4035(of)S10 I4152(ash)S10 R4324(causes)S4620(the)S4776(shell)S4999(to)S5110(exit)S1080 V1080(when)S1323(a)S1393(command)S1814(returns)S2119(1)S2194(even)S(though)278 2409 A2712(that)S2888(contradicts)S3355(the)S(convention)446 3503 A3974(described)S4385(here.)S1248 V1080(When)S1346(a)S1417(command)S1839(is)S1932(terminated)S2389(by)S2515(a)S2586(signal,)S2877(the)S3026(uses)S(128)150 3225 A3401(plus)S3594(the)S3743(signal)S4009(number)S4342(as)S4452(the)S4601(exit)S4778(code)S4994(for)S5138(the)S1368 V1080(command.)S1608 V10 B864(Builtin)S1186(Commands)S1776 V10 R1080(This)S1299(concluding)S1785(section)S2111(lists)S2314(the)S(builtin)262 2478 A2781(commands)S3257(which)S3544(are)S(builtin)262 3709 A(because)319 4012 A4372(they)S4586(need)S4817(to)S4936(perform)S1896 V1080(some)S1327(operation)S1742(that)S1928(can't)S2165(be)S2295(performed)S2750(by)S2885(a)S2965(separate)S3331(process.)S3718(In)S(addition)329 3837 A4201(to)S4314(these,)S4581(there)S4817(are)S4975(several)S2016 V1080(other)S1314(commands)S1776(\()S10 I1810(catf)S10 R1969(,)S10 I2021(echo)S10 R2219(,)S10 I2271(expr)S10 R2458(,)S10 I2510(line)S10 R2669(,)S10 I2721(nlecho)S10 R2997(,)S10 I3050(test)S10 R3198(,)S3251(``)S10 I3319(:)S10 R3361('',)S3482(and)S10 I3655(true)S10 R3825(\))S3887(which)S4161(can)S4329(optionally)S4764(be)S4887(compiled)S2136 V1080(into)S1267(the)S1421(shell.)S1691(The)S(builtin)262 1878 A2170(commands)S2635(described)S3051(below)S3327(that)S(accept)258 3508 A3796(options)S4121(use)S4285(the)S4438(System)S4764(V)S4867(Release)S5211(2)S2256 V10 I1080(getopt)S10 R1339(\(3\))S1482(syntax.)S2544 V10 B1080(bg)S10 R1211([)S10 I1270(job)S10 R1423(])S(...)75 1482 A2664 V1230(Continue)S1629(the)S1783(speci\256ed)S2172(jobs)S2370(\(or)S2519(the)S2674(current)S2992(job)S3152(if)S3246(no)S3378(jobs)S3577(are)S3733(given\))S4022(in)S4132(the)S(background.)499 4287 A4843(This)S5054(com-)S2784 V1230(mand)S1478(is)S1570(only)S1773(available)S2162(on)S2287(systems)S2630(with)S2834(Bekeley)S3189(job)S3342(control.)S2952 V10 B1080(command)S10 I(command)391 1530 A1946(arg)S10 R(...)75 2093 A3072 V1230(Execute)S1592(the)S1752(speci\256ed)S(builtin)262 2147 A2446(command.)S2929(\(This)S3179(is)S3283(useful)S3566(when)S(you)150 3821 A4009(have)S4237(a)S4320(shell)S4548(function)S4921(with)S5138(the)S3192 V1230(same)S1462(name)S1705(as)S1814(a)S(builtin)262 1884 A2171(command.\))S3360 V10 B1080(cd)S10 R1206([)S10 I1265(directory)S10 R1659(])S3480 V1230(Switch)S1547(to)S1662(the)S1822(speci\256ed)S2217(directory)S2618(\(default)S2969($HOME\).)S3437(If)S3542(the)S3702(an)S3834(entry)S4078(for)S4234(CDPATH)S4676(appears)S5022(in)S5138(the)S3600 V1230(environment)S1769(of)S1884(the)S2038(cd)S2164(command)S2591(or)S2706(the)S2859(shell)S3079(variable)S3434(CDPATH)S3868(is)S3965(set)S4107(and)S4282(the)S4435(directory)S4829(name)S5077(does)S3720 V1230(not)S1395(begin)S1655(with)S1871(a)S1953(slash,)S2217(then)S2428(the)S2589(directories)S3053(listed)S3309(in)S3425(CDPATH)S(will)157 3867 A4062(be)S4195(searched)S4586(for)S4742(the)S4903(speci\256ed)S3840 V1230(directory.)S1682(The)S1877(format)S2184(of)S2306(CDPATH)S2748(is)S2853(the)S3013(same)S3257(as)S3378(that)S3566(of)S3687(PATH.)S4038(In)S4159(an)S4291(interactive)S4754(shell,)S5006(the)S5166(cd)S3960 V1230(command)S(will)157 1652 A1835(print)S2051(out)S2205(the)S2354(name)S2598(of)S2708(the)S2857(directory)S3247(that)S3424(it)S3506(actually)S3851(switched)S4235(to)S4339(if)S4427(this)S4598(is)S4691(different)S5065(from)S4080 V1230(the)S1384(name)S1633(that)S1815(the)S1969(user)S2168(gave.)S2439(These)S2711(may)S2915(be)S3041(different)S3420(either)S(because)319 3680 A4029(the)S4182(CDPATH)S4616(mechanism)S5104(was)S4200 V1230(used)S1439(or)S(because)319 1548 A1892(a)S1962(symbolic)S2355(link)S2536(was)S2718(crossed.)S4368 V10 B1080(.)S10 I1130(\256le)S4488 V10 R1230(The)S1414(commands)S1876(in)S1981(the)S2131(speci\256ed)S2516(\256le)S2672(are)S2823(read)S3024(and)S3196(executed)S3581(by)S3708(the)S3858(shell.)S4125(A)S4225(path)S4425(search)S4710(is)S4804(not)S(done)195 4960 A5183(to)S4608 V1230(\256nd)S1424(the)S1585(\256le)S(because)319 1752 A2109(the)S2270(directories)S2734(in)S2850(PATH)S3152(generally)S3565(contain)S3899(\256les)S4105(that)S4294(are)S4456(intended)S4840(to)S4955(be)S5087(exe-)S4728 V1230(cuted,)S1498(not)S1651(read.)S4896 V10 B1080(eval)S10 I1278(string)S10 R(...)75 1520 A5016 V1230(The)S1425(strings)S1731(are)S1893(parsed)S2194(as)S2316(shell)S2544(commands)S3017(and)S3200(executed.)S3647(\(This)S3899(differs)S4202(from)S4437(the)S4599(System)S4934(V)S5046(shell,)S5136 V1230(which)S1519(concatenates)S2077(the)S2243(arguments)S2705(\(separated)S3163(by)S(spaces\))297 3306 A3646(and)S3834(parses)S4128(the)S4293(result)S4559(as)S4685(a)S4772(single)S5054(com-)S5256 V1230(mand.\))S5424 V10 B1080(exec)S10 R1290([)S10 I(command)391 1349 A1765(arg)S10 R(...)75 1912 A2037(])S5544 V1230(Unless)S10 I(command)391 1537 A10 R1961(is)S(omitted,)332 2061 A2426(the)S2582(shell)S2805(process)S3140(is)S(replaced)342 3240 A3615(with)S3828(the)S3985(speci\256ed)S4377(program)S4752(\(which)S5066(must)S5664 V1230(be)S1367(a)S1454(real)S1648(program,)S2056(not)S2226(a)S2313(shell)S(builtin)262 2545 A2849(or)S2975(function\).)S3436(Any)S3651(redirections)S4169(on)S4310(the)S4474(exec)S4700(command)S5137(are)S5784 V1230(marked)S1566(as)S1684(permanent,)S2169(so)S2293(that)S2479(they)S2687(are)S2846(not)S(undone)295 3009 A3339(when)S3592(the)S3750(exec)S3970(command)S4401(\256nishes.)S4793(If)S4896(the)S5054(com-)S5904 V1230(mand)S1478(is)S1570(not)S(found,)259 1723 A2007(the)S2155(exec)S2365(command)S2786(causes)S3074(the)S3222(shell)S3437(to)S3540(exit.)S6072 V10 B1080(exit)S10 R1262([)S10 I1321(exitstatus)S10 R1726(])S6192 V1230(Terminate)S1672(the)S1822(shell)S2040(process.)S2420(If)S10 I2516(exitstatus)S10 R2924(is)S3019(given)S3270(it)S3354(is)S3449(used)S3661(as)S3773(the)S3924(exit)S4103(status)S4360(of)S4472(the)S(shell;)218 4623 A4869(otherwise)S6312 V1230(the)S1378(exit)S1554(status)S1808(of)S1917(the)S(preceding)397 2065 A2487(command)S2908(is)S3000(used.)S6480 V10 B1080(export)S10 I1385(name)S10 R(...)75 1611 A6600 V1230(The)S1420(speci\256ed)S1811(names)S2101(are)S(exported)352 2258 A2643(so)S2765(that)S2949(they)S(will)157 3155 A3345(appear)S3647(in)S3758(the)S3914(environment)S4456(of)S4574(subsequent)S5054(com-)S6720 V1230(mands.)S1569(The)S1753(only)S1958(way)S2153(to)S(un-export)391 2258 A2676(a)S2748(variable)S3100(is)S3194(to)S3299(unset)S3538(it.)S10 I3671(Ash)S10 R3848(allows)S4137(the)S4286(value)S4530(of)S4640(a)S4711(variable)S5062(to)S5166(be)S6840 V1230(set)S1367(at)S1465(the)S1613(same)S1845(time)S2049(it)S2130(is)S(exported)352 2222 A2599(by)S(writing)291 2724 A7080 V10 B1630(export)S10 R1935(name=value)S7320 V1230(With)S1456(no)S1581(arguments)S2025(the)S(export)257 2173 A2455(command)S2876(lists)S3063(the)S3211(names)S3493(of)S3602(all)S(exported)352 3728 A4105(variables.)S7903 V720(Page)S941(7)S2654(\()S2696(March)S2984(7,)S(1991)200 3084 A3292(\))S4455(September)S4911(13,)S(1996)200 5061 A8143 VEP%%Page: 8 8BP/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 V10 B1080(fg)S10 R1189([)S10 I1248(job)S10 R1401(])S1080 V1230(Move)S1500(the)S1659(speci\256ed)S2053(job)S2217(or)S2337(the)S2496(current)S2818(job)S2983(to)S3098(the)S(foreground.)472 3258 A3792(This)S4008(command)S4441(is)S4545(only)S4760(available)S5161(on)S1200 V1230(systems)S1573(with)S1777(Bekeley)S2132(job)S2285(control.)S1368 V10 B1080(getopts)S10 I1413(optstring)S1800(var)S1488 V10 R1230(The)S1412(System)S1733(V)S10 I1831(getopts)S10 R2146(command.)S1656 V10 B1080(ha

⌨️ 快捷键说明

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