Reputation: 471
Can anyone explain me what is the use of init.tcl
?
When actually it is loaded by the TCL
interpreter?
The description for this file is shown as
startup file for TCL .
But According to my knowledge .tclshrc
is the start up file.
Can anyone explain this?
Upvotes: 2
Views: 1575
Reputation: 15163
Actually, init.tcl is the first file that is loaded by a Tcl_Interp*. Its job is to setup the different package loading mechanisms.
Some programs, most notably tclsh
, will source the .tclshrc
. This is usually done using Tcl_SourceRCFile
.
So init.tcl
is sourced for every Tcl interpreter, while the .tclshrc
is only sourced by some programs that explicitly do that.
* does not apply to safe interpreters
Upvotes: 5