📄 info.n
字号:
'\"'\" Copyright (c) 1993 The Regents of the University of California.'\" Copyright (c) 1994-1997 Sun Microsystems, Inc.'\" Copyright (c) 1993-1997 Bell Labs Innovations for Lucent Technologies'\"'\" See the file "license.terms" for information on usage and redistribution'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.'\" '\" SCCS: @(#) info.n 1.17 97/05/19 14:48:52'\" .so man.macros.TH info n 7.5 Tcl "Tcl Built-In Commands".BS'\" Note: do not modify the .SH NAME line immediately below!.SH NAMEinfo \- Return information about the state of the Tcl interpreter.SH SYNOPSIS\fBinfo \fIoption \fR?\fIarg arg ...\fR?.BE.SH DESCRIPTION.PPThis command provides information about various internals of the Tclinterpreter.The legal \fIoption\fR's (which may be abbreviated) are:.TP\fBinfo args \fIprocname\fRReturns a list containing the names of the arguments to procedure\fIprocname\fR, in order. \fIProcname\fR must be the name of aTcl command procedure..TP\fBinfo body \fIprocname\fRReturns the body of procedure \fIprocname\fR. \fIProcname\fR must bethe name of a Tcl command procedure..TP\fBinfo cmdcount\fRReturns a count of the total number of commands that have been invokedin this interpreter..TP\fBinfo commands \fR?\fIpattern\fR?If \fIpattern\fR isn't specified,returns a list of names of all the Tcl commands in the current namespace,including both the built-in commands written in C andthe command procedures defined using the \fBproc\fR command.If \fIpattern\fR is specified,only those names matching \fIpattern\fR are returned.Matching is determined using the same rules as for \fBstring match\fR.\fIpattern\fR can be a qualified name like \fBFoo::print*\fR.That is, it may specify a particular namespaceusing a sequence of namespace names separated by \fB::\fRs,and may have pattern matching special charactersat the end to specify a set of commands in that namespace.If \fIpattern\fR is a qualified name,the resulting list of command names has each one qualified with the nameof the specified namespace..TP\fBinfo complete \fIcommand\fRReturns 1 if \fIcommand\fR is a complete Tcl command in the sense ofhaving no unclosed quotes, braces, brackets or array element names,If the command doesn't appear to be complete then 0 is returned.This command is typically used in line-oriented input environmentsto allow users to type in commands that span multiple lines; if thecommand isn't complete, the script can delay evaluating it until additionallines have been typed to complete the command..TP\fBinfo default \fIprocname arg varname\fR\fIProcname\fR must be the name of a Tcl command procedure and \fIarg\fRmust be the name of an argument to that procedure. If \fIarg\fRdoesn't have a default value then the command returns \fB0\fR.Otherwise it returns \fB1\fR and places the default value of \fIarg\fRinto variable \fIvarname\fR..TP\fBinfo exists \fIvarName\fRReturns \fB1\fR if the variable named \fIvarName\fR exists in thecurrent context (either as a global or local variable), returns \fB0\fRotherwise..TP\fBinfo globals \fR?\fIpattern\fR?If \fIpattern\fR isn't specified, returns a list of all the namesof currently-defined global variables.Global variables are variables in the global namespace.If \fIpattern\fR is specified, only those names matching \fIpattern\fRare returned. Matching is determined using the same rules as for\fBstring match\fR..TP\fBinfo hostname\fRReturns the name of the computer on which this invocation is beingexecuted..TP\fBinfo level\fR ?\fInumber\fR?If \fInumber\fR is not specified, this command returns a numbergiving the stack level of the invoking procedure, or 0 if thecommand is invoked at top-level. If \fInumber\fR is specified,then the result is a list consisting of the name and arguments for theprocedure call at level \fInumber\fR on the stack. If \fInumber\fRis positive then it selects a particular stack level (1 refersto the top-most active procedure, 2 to the procedure it called, andso on); otherwise it gives a level relative to the current level(0 refers to the current procedure, -1 to its caller, and so on).See the \fBuplevel\fR command for more information on what stacklevels mean..TP\fBinfo library\fRReturns the name of the library directory in which standard Tclscripts are stored.This is actually the value of the \fBtcl_library\fRvariable and may be changed by setting \fBtcl_library\fR.See the \fBtclvars\fR manual entry for more information..TP\fBinfo loaded \fR?\fIinterp\fR?Returns a list describing all of the packages that have been loaded into\fIinterp\fR with the \fBload\fR command.Each list element is a sub-list with two elements consisting of thename of the file from which the package was loaded and the name ofthe package.For statically-loaded packages the file name will be an empty string.If \fIinterp\fR is omitted then information is returned for all packagesloaded in any interpreter in the process.To get a list of just the packages in the current interpreter, specifyan empty string for the \fIinterp\fR argument..TP\fBinfo locals \fR?\fIpattern\fR?If \fIpattern\fR isn't specified, returns a list of all the namesof currently-defined local variables, including arguments to thecurrent procedure, if any.Variables defined with the \fBglobal\fR and \fBupvar\fR commandswill not be returned.If \fIpattern\fR is specified, only those names matching \fIpattern\fRare returned. Matching is determined using the same rules as for\fBstring match\fR..TP\fBinfo nameofexecutable\fRReturns the full path name of the binary file from which the applicationwas invoked. If Tcl was unable to identify the file, then an emptystring is returned..TP\fBinfo patchlevel\fRReturns the value of the global variable \fBtcl_patchLevel\fR; seethe \fBtclvars\fR manual entry for more information..TP\fBinfo procs \fR?\fIpattern\fR?If \fIpattern\fR isn't specified, returns a list of all thenames of Tcl command procedures in the current namespace.If \fIpattern\fR is specified,only those procedure names in the current namespacematching \fIpattern\fR are returned.Matching is determined using the same rules as for\fBstring match\fR..TP\fBinfo script\fRIf a Tcl script file is currently being evaluated (i.e. there is acall to \fBTcl_EvalFile\fR active or there is an active invocationof the \fBsource\fR command), then this command returns the nameof the innermost file being processed. Otherwise the command returns anempty string..TP\fBinfo sharedlibextension\fRReturns the extension used on this platform for the names of filescontaining shared libraries (for example, \fB.so\fR under Solaris).If shared libraries aren't supported on this platform then an emptystring is returned..TP\fBinfo tclversion\fRReturns the value of the global variable \fBtcl_version\fR; seethe \fBtclvars\fR manual entry for more information..TP\fBinfo vars\fR ?\fIpattern\fR?If \fIpattern\fR isn't specified,returns a list of all the names of currently-visible variables.This includes locals and currently-visible globals.If \fIpattern\fR is specified, only those names matching \fIpattern\fRare returned. Matching is determined using the same rules as for\fBstring match\fR.\fIpattern\fR can be a qualified name like \fBFoo::option*\fR.That is, it may specify a particular namespaceusing a sequence of namespace names separated by \fB::\fRs,and may have pattern matching special charactersat the end to specify a set of variables in that namespace.If \fIpattern\fR is a qualified name,the resulting list of variable nameshas each matching namespace variable qualified with the nameof its namespace..SH KEYWORDScommand, information, interpreter, level, namespace, procedure, variable
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -