change variable of TCL file from top

Status
Not open for further replies.

amitk3553

Advanced Member level 4
Joined
Jul 20, 2012
Messages
117
Helped
2
Reputation
4
Reaction score
2
Trophy points
1,298
Location
DELHI, INDIA
Activity points
1,982
I have TCL script.

I have to change its variable for different IPs.

I want to change it from outside,not changing by going inside for every IP.

Like name of TCL file + some command to change its inside variable

e.g I have to change following

set TOP "timer"

here i have to chane next time "backbone"

So i want to change it ouside the file,from filename

Please Elaborate

Thanks
 

Hai amit,

use command line arguments in this case..

tclsh argv.tcl a b c


inside the code

set TOP "[lindex $argv 0]"

automatically value a is assigned to variable TOP thats it..
 
Hai amit,

use command line arguments in this case..

tclsh argv.tcl a b c


inside the code

set TOP "[lindex $argv 0]"

automatically value a is assigned to variable TOP thats it..

Hello friend I am using it in dc_shell(Design compiler)
where I am using the following command to execute

source main_dc.tcl

So can you tell me where i have to write the desired name like a,b,c

I had written like this

source main_dc.tcl a

but does not work.Is there any other to perform it.

please elaborate it,Thanks
 

Hai amit,

Here u are just sourcing..

u will call a tclsh code inside this right..

so mention in that place....

- - - Updated - - -

if u dont have tclsh code then

put the below command in terminal

setenv TOP "timer"

u can set outside without entering inside the program..

then run the program
 


But i want it to change at the place where I am sourcing.

Is it possible?
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…