📄 unknown.n
字号:
'\"'\" Copyright (c) 1993 The Regents of the University of California.'\" Copyright (c) 1994-1996 Sun Microsystems, Inc.'\"'\" See the file "license.terms" for information on usage and redistribution'\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.'\" '\" SCCS: @(#) unknown.n 1.8 96/10/09 08:29:28'\" .so man.macros.TH unknown n "" Tcl "Tcl Built-In Commands".BS'\" Note: do not modify the .SH NAME line immediately below!.SH NAMEunknown \- Handle attempts to use non-existent commands.SH SYNOPSIS\fBunknown \fIcmdName \fR?\fIarg arg ...\fR?.BE.SH DESCRIPTION.PPThis command is invoked by the Tcl interpreter whenever a scripttries to invoke a command that doesn't exist. The implementationof \fBunknown\fR isn't part of the Tcl core; instead, it is alibrary procedure defined by default when Tcl starts up. Youcan override the default \fBunknown\fR to change its functionality..PPIf the Tcl interpreter encounters a command name for which thereis not a defined command, then Tcl checks for the existence ofa command named \fBunknown\fR.If there is no such command, then the interpreter returns anerror.If the \fBunknown\fR command exists, then it is invoked witharguments consisting of the fully-substituted name and argumentsfor the original non-existent command.The \fBunknown\fR command typically does things like searchingthrough library directories for a command procedure with the name\fIcmdName\fR, or expanding abbreviated command names to full-length,or automatically executing unknown commands as sub-processes.In some cases (such as expanding abbreviations) \fBunknown\fR willchange the original command slightly and then (re-)execute it.The result of the \fBunknown\fR command is used as the result forthe original non-existent command..PPThe default implementation of \fBunknown\fR behaves as follows.It first calls the \fBauto_load\fR library procedure to load the command.If this succeeds, then it executes the original command with itsoriginal arguments.If the auto-load fails then \fBunknown\fR calls \fBauto_execok\fRto see if there is an executable file by the name \fIcmd\fR.If so, it invokes the Tcl \fBexec\fR commandwith \fIcmd\fR and all the \fIargs\fR as arguments.If \fIcmd\fR can't be auto-executed, \fBunknown\fR checks tosee if the command was invoked at top-level and outside of anyscript. If so, then \fBunknown\fR takes two additional steps.First, it sees if \fIcmd\fR has one of the following three forms:\fB!!\fR, \fB!\fIevent\fR, or \fB^\fIold\fB^\fInew\fR?\fB^\fR?.If so, then \fBunknown\fR carries out history substitutionin the same way that \fBcsh\fR would for these constructs.Finally, \fBunknown\fR checks to see if \fIcmd\fR isa unique abbreviation for an existing Tcl command.If so, it expands the command name and executes the command withthe original arguments.If none of the above efforts has been able to executethe command, \fBunknown\fR generates an error return.If the global variable \fBauto_noload\fR is defined, then the auto-loadstep is skipped.If the global variable \fBauto_noexec\fR is defined then theauto-exec step is skipped.Under normal circumstances the return value from \fBunknown\fRis the return value from the command that was eventuallyexecuted..SH KEYWORDSerror, non-existent command
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -