1mNAME0m
       unknown - Handle attempts to use non-existent commands

1mSYNOPSIS0m
       1munknown 4m22mcmdName24m ?4marg24m 4marg24m 4m...24m?


1mDESCRIPTION0m
       This  command is invoked by the Tcl interpreter whenever a script tries
       to invoke a command that doesn't exist.  The implementation of  1munknown0m
       isn't part of the Tcl core;  instead, it is a library procedure defined
       by default when Tcl starts up.  You can override the default 1munknown 22mto
       change its functionality.

       If the Tcl interpreter encounters a command name for which there is not
       a defined command, then Tcl checks for the existence of a command named
       1munknown22m.   If there is no such command, then the interpreter returns an
       error.  If the 1munknown 22mcommand exists, then it is  invoked  with  argu-
       ments  consisting  of  the fully-substituted name and arguments for the
       original non-existent command.   The  1munknown  22mcommand  typically  does
       things  like searching through library directories for a command proce-
       dure with the name 4mcmdName24m, or expanding abbreviated command  names  to
       full-length,  or  automatically  executing unknown commands as sub-pro-
       cesses.  In some cases (such as expanding abbreviations)  1munknown  22mwill
       change  the  original  command  slightly and then (re-)execute it.  The
       result of the 1munknown 22mcommand is used as the result  for  the  original
       non-existent command.

       The  default  implementation  of  1munknown 22mbehaves as follows.  It first
       calls the 1mauto_load 22mlibrary procedure to load  the  command.   If  this
       succeeds, then it executes the original command with its original argu-
       ments.  If the auto-load fails then 1munknown 22mcalls 1mauto_execok 22mto see if
       there is an executable file by the name 4mcmd24m.  If so, it invokes the Tcl
       1mexec 22mcommand with 4mcmd24m and all the 4margs24m as arguments.  If 4mcmd24m  can't  be
       auto-executed, 1munknown 22mchecks to see if the command was invoked at top-
       level and outside of any script.  If so, then 1munknown 22mtakes  two  addi-
       tional  steps.   First,  it  sees if 4mcmd24m has one of the following three
       forms: 1m!!22m, 1m!4m22mevent24m, or 1m^4m22mold24m1m^4m22mnew24m?1m^22m?.  If so,  then  1munknown  22mcarries  out
       history  substitution  in  the  same  way that 1mcsh 22mwould for these con-
       structs.  Finally, 1munknown 22mchecks to see if 4mcmd24m is a  unique  abbrevia-
       tion  for  an existing Tcl command.  If so, it expands the command name
       and executes the command with the original arguments.  If none  of  the
       above  efforts  has been able to execute the command, 1munknown 22mgenerates
       an error return.  If the global variable 1mauto_noload 22mis  defined,  then
       the  auto-load  step is skipped.  If the global variable 1mauto_noexec 22mis
       defined then the auto-exec step is skipped.  Under normal circumstances
       the return value from 1munknown 22mis the return value from the command that
       was eventually executed.


1mSEE ALSO0m
       info(n), proc(n)


1mKEYWORDS0m
