PDA

View Full Version : How to use variable set from terminal in TCL ?



tusharv
April 1st, 2009, 01:12 PM
Hi All,

I have set one variable PROJECT_PATH.
So How can I use this variable in any TCL file ?

Thanks,
Tushar

stevescripts
April 1st, 2009, 04:01 PM
I *assume* here, that you are talking about setting an environment variable - if so,
it will live in tcl's environment array.

From an interactive tclsh:



puts $env(PROJECT_PATH)


To get the entire contents of what tcl knows as the environment array:



parry env


Hope this answers your question?

Steve

tusharv
April 2nd, 2009, 04:44 AM
Hi stevescripts,

Yes Your ans satisfies my need.
And regarding your second code
parry env I think It should be
parray env

Thanks,
Tusharv

stevescripts
April 2nd, 2009, 04:29 PM
Typo ... duh!:mad: