Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sourcing Files and Glob Command

Status
Not open for further replies.

MrGameCube

Programmer
Jun 24, 2005
1
0
0
US
[Warning New User Getting Used to the Forums]

In the program that I am writting I ran into the problem where I need to source a bunch of different files in order to do this I created a variable which would hold the results of glob command *.tcl It worked great except for the fact that it grabs the name of the main file as well. So when I go through and try to source all the files it trys to source the main file in the main file.

I realize I could just check for the main files name and not source the file if it was the main file. But in all of this it brought up the question.

Is there a way for a file to know its name via some command or method without you telling it what it's name is?

Thanks in advance.
 
info script ?filename?
If a Tcl script file is currently being evaluated (i.e. there is a call to Tcl_EvalFile active or there is an active invocation of the source command), then this command returns the name of the innermost file being processed. If filename is specified, then the return value of this command will be modified for the duration of the active invocation to return that name. This is useful in virtual file system applications. Otherwise the command returns an empty string.

_________________
Bob Rashkin
rrashkin@csc.com
 
the variable $argv0 will give you the name of the script being run.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top