Here is the code i ended up using:
puts [regsub -all {\$[A-Z0-9]+} $userInput {$env(&)] junk]
puts "First round: $junk"
puts "Found: [regsub -all {\(\$} $junk {(} junk2]"
puts "Final result: $junk2"
Now if the user puts this in the text box...
I am going to look into the 'regsub' command to do the parsing for me.
I will basically instruct it to look for '$...' and replace that with '$env(...)'
Any tips from the pattern matching gurus out there? =)
The problem with that last post is that i can't count on the user to type in the env variables in a fixed pattern. He/she could type something like these below:
someprog -file $PATH/abc/def -file2 $PATH2/ghi
someprog $ABC
someprog $ABC/file1
so the problem is that i would have to do extensive...
Well the problem with using '$env(CVSROOT)' is the fact that the user will be supplying the envrionment variables from the GUI. So i can't expect the user to type in the '$env()' around any env the want to use. Lets say i want to make it simpler for the user so they can just pass in '$CVSROOT'...
Thanks for the tip. But it still does not work for me.
Lets say I want to issue an 'ls' command on a directory that is defined in this env variable: "$CVSROOT"
I am trying it this way:
catch {exec ls {$CVSROOT}} retval
puts "Val: $retVal"
I get this output:
Val: ls...
Ok. I have a problem in TCL that I hope someone here can help me out with. The problem is with using the 'exec/eval' command. I want to be able to execute a command where the command involves an environment variable. For example; lets say I want to say
echo $PATH
the problem is that the user...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.