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

📄 plan9.ps

📁 早期freebsd实现
💻 PS
📖 第 1 页 / 共 5 页
字号:
10 R f('s file descriptor 19.)3 804 1 4008 2442 t10 B f( documents)1 486(20. Here)1 385 2 720 2682 t10 I f(Rc)720 2838 w10 R f( to commands, as in this)5 982(procedures may include data, called ``here documents'', to be provided as input)11 3206 2 852 2838 t(version of the)2 549 1 720 2958 t10 I f(tel)1294 2958 w10 R f(command)1419 2958 w9 CW f(for\(i\) grep $i <<!)3 972 1 1008 3128 t(...)1008 3238 w(nls 2T-402 2912)2 810 1 1008 3348 t(norman 2C-514 2842)2 972 1 1008 3458 t(pjw 2T-502 7214)2 810 1 1008 3568 t(...)1008 3678 w(!)1008 3788 w10 R f(A here document is introduced by the redirection symbol)8 2288 1 720 3968 t10 CW f(<<)3034 3968 w10 R f( by an arbitrary eof marker \()6 1141(, followed)1 406 2 3154 3968 t10 CW f(!)4701 3968 w10 R f(in the)1 227 1 4813 3968 t( to a line containing only the eof marker are saved in a tempo-)13 2507( following the command, up)4 1142(example\). Lines)1 671 3 720 4088 t(rary file that it connected to the command's standard input when it is run.)13 2935 1 720 4208 t10 I f(Rc)720 4364 w10 R f( following)1 414( The)1 205(does variable substitution in here documents.)5 1804 3 850 4364 t10 I f(subst)3298 4364 w10 R f(command:)3529 4364 w9 CW f(ed $3 <<EOF)2 594 1 1008 4534 t(g/$1/s//$2/g)1008 4644 w(w)1008 4754 w(EOF)1008 4864 w10 R f( of)1 113(changes all occurrences)2 954 2 720 5044 t10 CW f($1)1817 5044 w10 R f(to)1967 5044 w10 CW f($2)2075 5044 w10 R f(in file)1 241 1 2225 5044 t10 CW f($3)2496 5044 w10 R f( include a literal)3 661(. To)1 191 2 2616 5044 t10 CW f($)3498 5044 w10 R f(in a here document, type)4 1004 1 3588 5044 t10 CW f($$)4622 5044 w10 R f( the)1 152(. If)1 146 2 4742 5044 t(name of a variable is followed immediately by)7 1861 1 720 5164 t10 CW f(\303)2606 5164 w10 R f(, the caret is deleted.)4 820 1 2666 5164 t( by enclosing the eof marker following)6 1643(Variable substitution can be entirely suppressed)5 1981 2 720 5320 t10 CW f(<<)4384 5320 w10 R f(in quotation)1 496 1 4544 5320 t(marks.)720 5440 w(Here documents may be provided on file descriptors other than 0 by typing, for example)14 3530 1 720 5596 t9 CW f(cmd <<[4]End)1 648 1 1008 5766 t(...)1008 5876 w(End)1008 5986 w10 B f(21. Signals)1 482 1 720 6286 t10 I f(Rc)720 6442 w10 R f( function with the name of)5 1067( A)1 124( an interrupt is received from the terminal.)7 1705(scripts normally terminate when)3 1293 4 851 6442 t( the usual way, but called when)6 1268(a signal, in lower case, is defined in)7 1449 2 720 6562 t10 I f(rc)3464 6562 w10 R f( of inter-)2 353( Signals)1 347(receives the signal.)2 766 3 3574 6562 t(est are:)1 285 1 720 6682 t10 CW f(sighup)720 6838 w10 R f( controlling teletype has disconnected from)5 1728(Hangup. The)1 546 2 970 6958 t10 I f(rc)3269 6958 w10 R f(.)3352 6958 w10 CW f(sigint)720 7114 w10 R f(The interrupt character \(usually ASCII del\) was typed on the controlling terminal.)11 3272 1 970 7234 tcleartomarkshowpagesaveobj restore%%EndPage: 8 8%%Page: 9 9/saveobj save defmark9 pagesetup10 R f(- 9 -)2 166 1 2797 480 t10 CW f(sigquit)720 840 w10 R f(The quit character \(usually ASCII fs, ctrl-\\\) was typed on the controlling terminal.)12 3278 1 970 960 t10 CW f(sigterm)720 1116 w10 R f(This signal is normally sent by)5 1231 1 970 1236 t10 I f(kill)2226 1236 w10 R f(\(1\).)2354 1236 w10 CW f(sigexit)720 1392 w10 R f(An artificial signal sent when)4 1176 1 970 1512 t10 I f(rc)2171 1512 w10 R f(is about to exit.)3 617 1 2279 1512 t(As an example,)2 618 1 720 1668 t9 CW f(fn sigint{)1 540 1 1008 1838 t(rm /tmp/junk)1 648 1 1224 1948 t(exit)1224 2058 w(})1008 2168 w10 R f(sets a trap for the keyboard interrupt that removes a temporary file before exiting.)13 3259 1 720 2348 t( routine is set to)4 651(Signals will be ignored if the signal)6 1434 2 720 2504 t10 CW f({})2833 2504 w10 R f( revert to their default behavior when their)7 1714(. Signals)1 373 2 2953 2504 t(handlers' definitions are deleted.)3 1308 1 720 2624 t10 B f(22. Environment)1 742 1 720 2864 t10 R f( Plan 9, the environ-)4 817( On)1 173( is a list of name-value pairs made available to executing binaries.)11 2645(The environment)1 685 4 720 3020 t( in a file system named)5 929(ment is stored)2 565 2 720 3140 t10 CW f(#e)2240 3140 w10 R f(, normally mounted on)3 914 1 2360 3140 t10 CW f(/env)3300 3140 w10 R f( value of each variable is stored)6 1269(. The)1 231 2 3540 3140 t( is not quite as horrendous as it sounds,)8 1577( \(This)1 262(in a separate file, with components terminated by ASCII nuls.)9 2481 3 720 3260 t( contents of)2 482( The)1 213( access is involved.\))3 828(the file system is maintained entirely in core, so no disk or network)12 2797 4 720 3380 t10 CW f(/env)720 3500 w10 R f(are shared on a per-process group basis)6 1579 1 987 3500 t10 S f(-)2593 3500 w10 R f( process group is created it effectively attaches)7 1885(when a new)2 480 2 2675 3500 t10 CW f(/env)720 3620 w10 R f( consequence of this organization is that)6 1603( A)1 122(to a new file system initialized with a copy of the old one.)12 2329 3 986 3620 t(commands can change environment entries and see the changes reflected in)10 3014 1 720 3740 t10 I f(rc)3759 3740 w10 R f(.)3842 3740 w( in the environment, although this could easily)7 1939(There is not currently a way on Plan 9 to place functions)11 2381 2 720 3896 t(done by mounting another instance of)5 1537 1 720 4016 t10 CW f(#e)2287 4016 w10 R f( can be)2 290( problem is that currently there)5 1259( The)1 210(on another directory.)2 844 4 2437 4016 t(only one instance of)3 807 1 720 4136 t10 CW f(#e)1552 4136 w10 R f(per process group.)2 734 1 1697 4136 t10 B f( Variables)1 436(23. Local)1 414 2 720 4376 t10 R f( assignment followed by a com-)5 1289( An)1 174( the duration of a single command.)6 1402(It is often useful to set a variable for)8 1455 4 720 4532 t( example)1 363( For)1 189(mand has this effect.)3 826 3 720 4652 t9 CW f(a=global)1008 4822 w(a=local echo $a)2 810 1 1008 4932 t(echo $a)1 378 1 1008 5042 t10 R f(will print)1 370 1 720 5222 t9 CW f(local)1008 5392 w(global)1008 5502 w10 R f(This works even for compound commands, like)6 1906 1 720 5682 t9 CW f(f=/fairly/long/file/name {)1 1404 1 1008 5852 t({ wc $f; spell $f; diff $f.old $f } |)9 1998 1 1224 5962 t(pr -h 'Facts about '$f | lp -ddp)7 1728 1 1332 6072 t(})1008 6182 w10 B f( \320)1 125(24. Examples)1 592 2 720 6482 t10 I f(cd, pwd)1 311 1 1462 6482 t10 R f(Here is a pair of functions that provide enhanced versions of the standard)12 2933 1 720 6638 t10 CW f(cd)3679 6638 w10 R f(and)3825 6638 w10 CW f(pwd)3996 6638 w10 R f(commands. \(Thanks)1 837 1 4203 6638 t(to Rob Pike for these.\))4 902 1 720 6758 tcleartomarkshowpagesaveobj restore%%EndPage: 9 9%%Page: 10 10/saveobj save defmark10 pagesetup10 R f(- 10 -)2 216 1 2772 480 t9 CW f( default prompt)2 810( #)1 486(ps1='% ')1 432 3 1008 830 t( a tab character)3 864( #)1 432(tab=' ')1 486 3 1008 940 t(fn pbd{)1 378 1 1008 1050 t(/bin/pwd|sed 's;.*/;;')1 1188 1 1116 1160 t(})1008 1270 w(fn cd{)1 324 1 1008 1380 t(builtin cd $1 &&)3 864 1 1116 1490 t(switch\($#*\){)1116 1600 w(case 0)1 324 1 1116 1710 t(dir=$home)1224 1820 w(prompt=\($ps1 $tab\))1 972 1 1224 1930 t(case *)1 324 1 1116 2040 t(switch\($1\))1224 2150 w(case /*)1 378 1 1224 2260 t(dir=$1)1332 2370 w(prompt=\(`{pbd}\303$ps1 $tab\))1 1350 1 1332 2480 t(case */* ..*)2 648 1 1224 2590 t(dir=\(\))1332 2700 w(prompt=\(`{pbd}\303$ps1 $tab\))1 1350 1 1332 2810 t(case *)1 324 1 1224 2920 t(dir=\(\))1332 3030 w(prompt=\($1\303$ps1 $tab\))1 1134 1 1332 3140 t(})1224 3250 w(})1116 3360 w(})1008 3470 w(fn pwd{)1 378 1 1008 3580 t(if\(\304 $#dir 0\))2 702 1 1116 3690 t(dir=`{/bin/pwd})1224 3800 w(echo $dir)1 486 1 1116 3910 t(})1008 4020 w10 R f(Function)720 4200 w10 CW f(pwd)1104 4200 w10 R f(is a version of the standard)5 1088 1 1312 4200 t10 CW f(pwd)2428 4200 w10 R f(that caches its value in variable)5 1270 1 2636 4200 t10 CW f($dir)3935 4200 w10 R f(, because the genuine)3 865 1 4175 4200 t10 CW f(pwd)720 4320 w10 R f(can be quite slow to execute.)5 1153 1 925 4320 t(Function)720 4476 w10 CW f(pbd)1114 4476 w10 R f( Function)1 419(is a helper that prints the last component of a directory name.)11 2589 2 1332 4476 t10 CW f(cd)4378 4476 w10 R f(calls the)1 344 1 4537 4476 t10 CW f(cd)4920 4476 w10 R f( so, it sets)3 404( If)1 119( was successful.)2 646(built-in, and checks that it)4 1057 4 720 4596 t10 CW f($dir)2974 4596 w10 R f(and)3242 4596 w10 CW f($prompt)3414 4596 w10 R f( prompt will include the)4 973(. The)1 233 2 3834 4596 t(last component of the current directory \(except in the home directory, where it will be null\), and)16 3869 1 720 4716 t10 CW f($dir)4616 4716 w10 R f(will)4884 4716 w(be reset either to the correct value or to)8 1562 1 720 4836 t10 CW f(\(\))2307 4836 w10 R f(, so that the)3 461 1 2427 4836 t10 CW f(pwd)2913 4836 w10 R f(function will work correctly.)3 1148 1 3118 4836 t10 B f( \320)1 125(25. Examples)1 592 2 720 5076 t10 I f(man)1462 5076 w10 R f(The)720 5232 w10 I f(man)900 5232 w10 R f( is called, for example, as)5 1017( It)1 111(command prints pages from of the Programmer's Manual.)7 2324 3 1097 5232 t9 CW f(man 3 isatty)2 648 1 1008 5402 t(man rc)1 324 1 1008 5512 t(man -t cat)2 540 1 1008 5622 t10 R f(In the first case, the page for)6 1192 1 720 5802 t10 I f(isatty)1946 5802 w10 R f( second case, the manual page for)6 1403( the)1 156( In)1 142(in section 3 is printed.)4 922 4 2197 5802 t10 I f(rc)4855 5802 w10 R f(is)4973 5802 w( specified, all sections are searched for the page, and it is found in sec-)14 2871( no manual section is)4 864(printed. Since)1 585 3 720 5922 t( the third case, the page for)6 1083( In)1 133(tion 1.)1 256 3 720 6042 t10 I f(cat)2217 6042 w10 R f(is typeset \(the)2 555 1 2364 6042 t10 CW f(-t)2944 6042 w10 R f(option\).)3089 6042 wcleartomarkshowpagesaveobj restore%%EndPage: 10 10%%Page: 11 11/saveobj save defmark11 pagesetup10 R f(- 11 -)2 216 1 2772 480 t9 CW f(cd /n/bowell/usr/man || {)3 1350 1 1008 830 t(echo $0: Manual not on line! >[1=2])6 1890 1 1116 940 t(exit 1)1 324 1 1116 1050 t(})1008 1160 w( default nroff)2 756(NT=n #)1 378 2 1008 1270 t(s='*' # section, default try all)5 1728 1 1008 1380 t(for\(i\) switch\($i\){)1 972 1 1008 1490 t(case -t)1 378 1 1008 1600 t(NT=t)1116 1710 w(case -n)1 378 1 1008 1820 t(NT=n)1116 1930 w(case -*)1 378 1 1008 2040 t(echo Usage: $0 '[-nt] [section] page ...' >[1=2])7 2592 1 1116 2150 t(exit 1)1 324 1 1116 2260 t(case [1-9] 10)2 702 1 1008 2370 t(s=$i)1116 2480 w(case *)1 324 1 1008 2590 t(eval 'pages=man'$s/$i'.*')1 1350 1 1116 2700 t(for\(page in $pages\){)2 1080 1 1116 2810 t(if\(test -f $page\))2 918 1 1224 2920 t($NT\303roff -man $page)2 1026 1 1332 3030 t(if not)1 324 1 1224 3140 t(echo $0: $i not found >[1=2])5 1512 1 1332 3250 t(})1116 3360 w(})1008 3470 w10 R f(Note the use of)3 619 1 720 3650 t10 CW f(eval)1368 3650 w10 R f( Without)1 382(to make a list of candidate manual pages.)7 1675 2 1637 3650 t10 CW f(eval)3723 3650 w10 R f(, the)1 176 1 3963 3650 t10 CW f(*)4168 3650 w10 R f(stored in)1 352 1 4258 3650 t10 CW f($s)4640 3650 w10 R f(would)4790 3650 w( if it weren't, it would be)6 1098(not trigger filename matching \320 it's enclosed in quotation marks, and even)11 3222 2 720 3770 t(expanded when assigned to)3 1098 1 720 3890 t10 CW f($s)1844 3890 w10 R f( causes its arguments to be re-processed by)7 1728(. Eval)1 259 2 1964 3890 t10 I f(rc)3977 3890 w10 R f('s parser and interpreter,)3 980 1 4060 3890 t(effectively delaying evaluation of the)4 1491 1 720 4010 t10 CW f(*)2236 4010 w10 R f(until the assignment to)3 909 1 2321 4010 t10 CW f($pages)3255 4010 w10 R f(.)3615 4010 w10 B f( \320)1 125(26. Examples)1 592 2 720 4250 t10 I f(holmdel)1462 4250 w10 R f(The following)1 575 1 720 4406 t10 I f(rc)1327 4406 w10 R f(script plays the deceptively simple game)5 1658 1 1442 4406 t10 I f(holmdel)3132 4406 w10 R f(, in which the players alternately name)6 1586 1 3454 4406 t(Bell Labs locations, the winner being the first to mention Holmdel.)10 2682 1 720 4526 t(This script is worth describing in detail \(rather, it would be if it weren't so silly.\))15 3222 1 720 4682 t(Variable)720 4838 w10 CW f($t)1097 4838 w10 R f( Including)1 443(is an abbreviation for the name of a temporary file.)9 2115 2 1251 4838 t10 CW f($pid)3844 4838 w10 R f(, initialized by)2 595 1 4084 4838 t10 I f(rc)4714 4838 w10 R f(to its)1 208 1 4832 4838 t( one)1 178(process-id, in the names of temporary files insures that their names won't collide, in case more than)16 4142 2 720 4958 t(instance of the script is running at a time.)8 1651 1 720 5078 t(Function)720 5234 w10 CW f(read)1102 5234 w10 R f( is the name of a variable into which a line gathered from standard input is read.)16 3223('s argument)1 475 2 1342 5234 t

⌨️ 快捷键说明

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