LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   tcl/tk $env(HOME) not found inside proc (https://www.linuxquestions.org/questions/programming-9/tcl-tk-%24env-home-not-found-inside-proc-646211/)

sharky 06-01-2008 09:31 AM

tcl/tk $env(HOME) not found inside proc
 
In a tcl/tk script I can have the command 'cd $env(HOME)' and it works. I verified that it works by 'puts [exec "ls"] and seeing that the output is from my home directory. However, if I put this line inside a proc the variable is not found.

As a work around I set a global variable to $env(HOME) outside the proc and pass $HOME to the proc. I'll be using a lot of environment variables in my scripts and this workaround is cumbersome. Is there a way to make environment variables such as $env(HOME) global?

sharky 06-01-2008 02:39 PM

This worked
 
Using $::env(HOME) within a proc worked.


All times are GMT -5. The time now is 04:15 PM.