1mNAME0m
       source - Evaluate a file or resource as a Tcl script

1mSYNOPSIS0m
       1msource 4m22mfileName0m

       1msource -rsrc 4m22mresourceName24m ?4mfileName24m?

       1msource -rsrcid 4m22mresourceId24m ?4mfileName24m?


1mDESCRIPTION0m
       This  command  takes the contents of the specified file or resource and
       passes it to the Tcl interpreter as a text script.   The  return  value
       from  1msource  22mis  the  return value of the last command executed in the
       script.  If an error occurs in evaluating the contents  of  the  script
       then the 1msource 22mcommand will return that error.  If a 1mreturn 22mcommand is
       invoked from within the script then the remainder of the file  will  be
       skipped  and  the  1msource  22mcommand will return normally with the result
       from the 1mreturn 22mcommand.

       The end-of-file character for files is '\32' (^Z)  for  all  platforms.
       The source command will read files up to this character.  This restric-
       tion does not exist for the 1mread 22mor 1mgets 22mcommands, allowing  for  files
       containing code and data segments (scripted documents).  If you require
       a ``^Z'' in code  for  string  comparison,  you  can  use  ``\032''  or
       ``\u001a'',  which  will  be  safely substituted by the Tcl interpreter
       into ``^Z''.

       The 4m-rsrc24m and 4m-rsrcid24m forms of this command are only available on  Mac-
       intosh  computers.  These versions of the command allow you to source a
       script from a 1mTEXT 22mresource.  You may specify  what  1mTEXT  22mresource  to
       source by either name or id.  By default Tcl searches all open resource
       files, which include the current application and any  loaded  C  exten-
       sions.   Alternatively,  you  may  specify  the 4mfileName24m where the 1mTEXT0m
       resource can be found.

1mEXAMPLE0m
       Run the script in the file 1mfoo.tcl 22mand then  the  script  in  the  file
       1mbar.tcl22m:
              1msource 22mfoo.tcl
              1msource 22mbar.tcl
       Alternatively:
              foreach scriptFile {foo.tcl bar.tcl} {
                 1msource 22m$scriptFile
              }


1mSEE ALSO0m
       file(n), cd(n), info(n)


1mKEYWORDS0m
