For Programmers: Free Programming Magazines  


Home > Archive > Tcl > July 2004 > weird behavior of tclsh









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author weird behavior of tclsh
Bhushit Joshipura

2004-07-31, 3:56 am

I think I am missing something badly.

I have lappend auto_path in my .tclshrc.
Isn't .tclshrc executed everytime you invoke tclsh?

Why am I getting 2 different outputs (and behaviors) when I do "tclsh
a.tcl" versus invoking tclsh and then sourcing a.tcl?

Thanks in advance,
-Bhushit

bhushit@jungle:/home/bhushit/learn/tcl/graph: head ~/.tclshrc
lappend auto_path <foo>/lib/tcllib
package require control
package require struct

bhushit@jungle:/home/bhushit/learn/tcl/graph: cat temp.tcl
puts $auto_path

bhushit@jungle:/home/bhushit/learn/tcl/graph: tclsh temp.tcl
<bar>/tcl8.3.3/lib/tcl8.3 <bar>/tcl8.3.3/lib /import/tools/lib

BUT

bhushit@jungle:/home/bhushit/learn/tcl/graph: tclsh
=========
8.3:/home/bhushit/learn/tcl/graph:-> source temp.tcl
<bar>/tcl8.3.3/lib/tcl8.3 <bar>/tcl8.3.3/lib /import/tools/lib
<foo>/lib/tcllib <foo>/lib/tcllib/control
Don Porter

2004-07-31, 3:56 am

Bhushit Joshipura wrote:
> I have lappend auto_path in my .tclshrc.
> Isn't .tclshrc executed everytime you invoke tclsh?


No.

http://www.tcl.tk/man/tcl8.4/UserCmd/tclsh.htm

"There is no automatic evaluation of .tclshrc when the name of a
script file is presented on the tclsh command line, but the script
file can always source it if desired."

--
| Don Porter Mathematical and Computational Sciences Division |
| donald.porter@nist.gov Information Technology Laboratory |
| http://math.nist.gov/~DPorter/ NIST |
|_______________________________________
_______________________________|
Don Porter

2004-07-31, 3:56 am

Bhushit Joshipura wrote:
> I have lappend auto_path in my .tclshrc.


What you probably want to use instead is the TCLLIBPATH
environment variable.

--
| Don Porter Mathematical and Computational Sciences Division |
| donald.porter@nist.gov Information Technology Laboratory |
| http://math.nist.gov/~DPorter/ NIST |
|_______________________________________
_______________________________|
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com