finish all in man1
[manpages-zh.git] / src / man1 / tclsh.1
blobbf44229f424e4da4a75f14a28d1d5ea0e3bb7305
1 '\"
2 '\" Copyright (c) 1993 The Regents of the University of California.
3 '\" Copyright (c) 1994-1996 Sun Microsystems, Inc.
4 '\"
5 '\" See the file "license.terms" for information on usage and redistribution
6 '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
7 '\" 
8 '\" 
9 '\" The definitions below are for supplemental macros used in Tcl/Tk
10 '\" manual entries.
11 '\"
12 '\" .AP type name in/out ?indent?
13 '\"     Start paragraph describing an argument to a library procedure.
14 '\"     type is type of argument (int, etc.), in/out is either "in", "out",
15 '\"     or "in/out" to describe whether procedure reads or modifies arg,
16 '\"     and indent is equivalent to second arg of .IP (shouldn't ever be
17 '\"     needed;  use .AS below instead)
18 '\"
19 '\" .AS ?type? ?name?
20 '\"     Give maximum sizes of arguments for setting tab stops.  Type and
21 '\"     name are examples of largest possible arguments that will be passed
22 '\"     to .AP later.  If args are omitted, default tab stops are used.
23 '\"
24 '\" .BS
25 '\"     Start box enclosure.  From here until next .BE, everything will be
26 '\"     enclosed in one large box.
27 '\"
28 '\" .BE
29 '\"     End of box enclosure.
30 '\"
31 '\" .CS
32 '\"     Begin code excerpt.
33 '\"
34 '\" .CE
35 '\"     End code excerpt.
36 '\"
37 '\" .VS ?version? ?br?
38 '\"     Begin vertical sidebar, for use in marking newly-changed parts
39 '\"     of man pages.  The first argument is ignored and used for recording
40 '\"     the version when the .VS was added, so that the sidebars can be
41 '\"     found and removed when they reach a certain age.  If another argument
42 '\"     is present, then a line break is forced before starting the sidebar.
43 '\"
44 '\" .VE
45 '\"     End of vertical sidebar.
46 '\"
47 '\" .DS
48 '\"     Begin an indented unfilled display.
49 '\"
50 '\" .DE
51 '\"     End of indented unfilled display.
52 '\"
53 '\" .SO
54 '\"     Start of list of standard options for a Tk widget.  The
55 '\"     options follow on successive lines, in four columns separated
56 '\"     by tabs.
57 '\"
58 '\" .SE
59 '\"     End of list of standard options for a Tk widget.
60 '\"
61 '\" .OP cmdName dbName dbClass
62 '\"     Start of description of a specific option.  cmdName gives the
63 '\"     option's name as specified in the class command, dbName gives
64 '\"     the option's name in the option database, and dbClass gives
65 '\"     the option's class in the option database.
66 '\"
67 '\" .UL arg1 arg2
68 '\"     Print arg1 underlined, then print arg2 normally.
69 '\"
70 '\"     # Set up traps and other miscellaneous stuff for Tcl/Tk man pages.
71 .if t .wh -1.3i ^B
72 .nr ^l \n(.l
73 .ad b
74 '\"     # Start an argument description
75 .de AP
76 .ie !"\\$4"" .TP \\$4
77 .el \{\
78 .   ie !"\\$2"" .TP \\n()Cu
79 .   el          .TP 15
80 .\}
81 .ta \\n()Au \\n()Bu
82 .ie !"\\$3"" \{\
83 \&\\$1  \\fI\\$2\\fP    (\\$3)
84 .\".b
85 .\}
86 .el \{\
87 .br
88 .ie !"\\$2"" \{\
89 \&\\$1  \\fI\\$2\\fP
90 .\}
91 .el \{\
92 \&\\fI\\$1\\fP
93 .\}
94 .\}
96 '\"     # define tabbing values for .AP
97 .de AS
98 .nr )A 10n
99 .if !"\\$1"" .nr )A \\w'\\$1'u+3n
100 .nr )B \\n()Au+15n
102 .if !"\\$2"" .nr )B \\w'\\$2'u+\\n()Au+3n
103 .nr )C \\n()Bu+\\w'(in/out)'u+2n
105 .AS Tcl_Interp Tcl_CreateInterp in/out
106 '\"     # BS - start boxed text
107 '\"     # ^y = starting y location
108 '\"     # ^b = 1
109 .de BS
111 .mk ^y
112 .nr ^b 1u
113 .if n .nf
114 .if n .ti 0
115 .if n \l'\\n(.lu\(ul'
116 .if n .fi
118 '\"     # BE - end boxed text (draw box now)
119 .de BE
121 .ti 0
122 .mk ^t
123 .ie n \l'\\n(^lu\(ul'
124 .el \{\
125 .\"     Draw four-sided box normally, but don't draw top of
126 .\"     box if the box started on an earlier page.
127 .ie !\\n(^b-1 \{\
128 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
130 .el \}\
131 \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\l'|0u-1.5n\(ul'
136 .nr ^b 0
138 '\"     # VS - start vertical sidebar
139 '\"     # ^Y = starting y location
140 '\"     # ^v = 1 (for troff;  for nroff this doesn't matter)
141 .de VS
142 .if !"\\$2"" .br
143 .mk ^Y
144 .ie n 'mc \s12\(br\s0
145 .el .nr ^v 1u
147 '\"     # VE - end of vertical sidebar
148 .de VE
149 .ie n 'mc
150 .el \{\
151 .ev 2
153 .ti 0
154 .mk ^t
155 \h'|\\n(^lu+3n'\L'|\\n(^Yu-1v\(bv'\v'\\n(^tu+1v-\\n(^Yu'\h'-|\\n(^lu+3n'
156 .sp -1
160 .nr ^v 0
162 '\"     # Special macro to handle page bottom:  finish off current
163 '\"     # box/sidebar if in box/sidebar mode, then invoked standard
164 '\"     # page bottom macro.
165 .de ^B
166 .ev 2
167 'ti 0
169 .mk ^t
170 .if \\n(^b \{\
171 .\"     Draw three-sided box if this is the box's first page,
172 .\"     draw two sides but no top otherwise.
173 .ie !\\n(^b-1 \h'-1.5n'\L'|\\n(^yu-1v'\l'\\n(^lu+3n\(ul'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
174 .el \h'-1.5n'\L'|\\n(^yu-1v'\h'\\n(^lu+3n'\L'\\n(^tu+1v-\\n(^yu'\h'|0u'\c
176 .if \\n(^v \{\
177 .nr ^x \\n(^tu+1v-\\n(^Yu
178 \kx\h'-\\nxu'\h'|\\n(^lu+3n'\ky\L'-\\n(^xu'\v'\\n(^xu'\h'|0u'\c
183 .if \\n(^b \{\
184 .mk ^y
185 .nr ^b 2
187 .if \\n(^v \{\
188 .mk ^Y
191 '\"     # DS - begin display
192 .de DS
197 '\"     # DE - end display
198 .de DE
203 '\"     # SO - start of list of standard options
204 .de SO
205 .SH "STANDARD OPTIONS"
208 .ta 5.5c 11c
209 .ft B
211 '\"     # SE - end of list of standard options
212 .de SE
214 .ft R
216 See the \\fBoptions\\fR manual entry for details on the standard options.
218 '\"     # OP - start of full description for a single option
219 .de OP
222 .ta 4c
223 Command-Line Name:      \\fB\\$1\\fR
224 Database Name:  \\fB\\$2\\fR
225 Database Class: \\fB\\$3\\fR
229 '\"     # CS - begin code excerpt
230 .de CS
233 .ta .25i .5i .75i 1i
235 '\"     # CE - end code excerpt
236 .de CE
240 .de UL
241 \\$1\l'|0\(ul'\\$2
243 .TH tclsh 1 "" Tcl "Tcl Applications"
245 '\" Note:  do not modify the .SH NAME line immediately below!
246 .SH NAME
247 tclsh \- 包含 Tcl 解释器的简单的 shell    
248 .SH "总览 SYNOPSIS"
249 \fBtclsh\fR ?\fIfileName arg arg ...\fR?
252 .SH "描述"
254 \fBTclsh\fR 是一个 shell     类应用程序,从它的标准输入或一个文件读 Tcl 命令并对其求值(evaluate)。     如果你不加参数的调用,则它交互式的执行,从标准输入读      Tcl     命令并向标准输出打印命令结果和出错信息。它一直运行直到调用 \fBexit\fR    命令或在它的标准输入上读到文件结束。如果在用户的主(home)目录里存在一个文件        \fB.tclshrc\fR  (或在 Windows 平台上的 \fBtclshrc.tcl\fR),在从标准输入读第一条命令之前,\fBtclsh\fR 把这个文件作为一个 Tcl 脚本来求值。
256 .SH "脚本文件 SCRIPT FILES"
258 如果加参数调用 \fBtclsh \fR则第一个参数是脚本文件的名字而任何额外的参数作为给脚本使用的变量(见后)。 \fBtclsh\fR        将从指名的文件中读 Tcl      命令而不是从标准输入读取;当到达文件结束时       \fBtclsh\fR  将退出。在这种情况下不自动的对 \fB.tclshrc\fR        求值,如果需要的话,脚本文件总是可以 \fBsource\fR(包含)它。
260 如果你建立的 Tcl       脚本文件的第一行是 
262 \fB#!/usr/local/bin/tclsh\fR
264 则如果你把它标记为可执行的,接着就可以直接在你的 shell   中调用这个脚本文件。这里假定了\fB tclsh\fR  被安装在缺省的位置 /usr/local/bin;如果它被安装在其他地方,那么你需要修改上述行来匹配之。许多 UNIX       系统不允许 \fB#!\fR  行超出     30 个字符的长度,所以要确定 \fBtclsh\fR           可执行文件能被用短文件名访问。
266 一个更好的途径是用下面三行来开始你的脚本文件:         
268 \fB#!/bin/sh
269 # the next line restarts using tclsh \e
270 exec tclsh "$0" "$@"\fR
272 这种方法比起前面的段落有三个好处。首先,\fBtclsh\fR    二进制文件的位置不需要填入(hard-wired into) 脚本中:      它可以在你的 shell 查找路径中的任何地方。其次,他超越了(get around)了上种方法的      30 字符的文件名的限制。第三,这种方法在 \fBtclsh\fR  自身也是 shell 脚本时仍可运行(一些系统要处理多体系或操作系统:      \fBtclsh\fR          脚本选择某个二进制文件来运行)。第三行导致 \fBsh\fR 和 \fBtclsh\fR      两者来处理脚本,但          \fBexec\fR 只被 \fBsh \fR执行。   \fBsh\fR      首先处理脚本文件;它把第二行作为脚本文件对待并执行第三行。\fBexec\fR      语句导致 shell 停止处理而启动 \fBtclsh\fR      来重新处理整个脚本。当 \fBtclsh\fR      启动时,因为第二行的反斜线导致第三行被作为第二行注释的一部分,它把所有三行都作为注释对待。         
275 You should note that it is also common practise to install tclsh with
276 its version number as part of the name.  This has the advantage of
277 allowing multiple versions of Tcl to exist on the same system at once,
278 but also the disadvantage of making it harder to write scripts that
279 start up uniformly across different versions of Tcl.
282 .SH "变量 VARIABLES"
284 \fBTclsh\fR 设置了下列 Tcl 变量:         
285 .TP 15
286 \fBargc\fR
287 包含 \fIarg\fR  参数的个数(没有则为 0),不包括脚本文件的名字。    
288 .TP 15
289 \fBargv\fR
290 包含一个 Tcl 列表,其元素依次是 \fIarg\fR  参数,如果没有 \fIarg\fR    参数则是一个空串。
291 .TP 15
292 \fBargv0\fR
293 如果指定了 \fIfileName\fR  则在此包含。否则。包含调用 \fBtclsh\fR    使用的名字。    
294 .TP 15
295 \fBtcl_interactive\fR
296 如果交互式运行 \fBtclsh\fR  则包含 1(不指定\fIfileName\fR 并且标准输入是一个终端类设备),否则是 0。      
298 .SH "提示符 PROMPTS"
300 当交互式的调用 \fBtclsh\fR  时,它通常为每条命令提示\(lq\fB%\fR\(rq。你可以通过设置变量 \fBtcl_prompt1\fR     和 \fBtcl_prompt2\fR 来改变提示符。如果存在变量    \fBtcl_prompt1\fR  则它必须由一个输出一个提示符的 Tcl     脚本组成;\fBtclsh\fR 对 \fBtcl_prompt1\fR     中的脚本求值而不是输出一个提示符。变量 \fBtcl_prompt2\fR      以类似的方式用在键入了换行而当前命令却不完整的时候;如果没设置     \fBtcl_prompt2\fR   则对不完整的命令不给以提示符。        
302 .SH "关键字 KEYWORDS"
303 argument, interpreter, prompt, script file, shell
305 .SH "[中文版维护人]"
306 .B 寒蝉退士
307 .SH "[中文版最新更新]"
308 .B 2001/06/20
309 .SH "《中国linux论坛man手册页翻译计划》:"
310 .BI http://cmpp.linuxforum.net