Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to print all environment variables in TCL?

In TCL, how can I print all environment variables using a single line command?

like image 780
becks Avatar asked Oct 23 '12 10:10

becks


People also ask

How do I print a list of the environmental variables?

Use " printenv " (or " env ") to list all the environment variables. Use " setenv varname value " and " unsetenv varname " to set and unset an environment variable. Use " set varname=value " and " unset varname " to set and unset a local variable for the current process.

How does Tcl read environment variables?

Environment variables are accessible via the built-in global variable env (fully qualified it is ::env ). You use this like any other Tcl array. yea, your procedure is executed, it gives all the environment variables.

How do I pass an environment variable in Tcl?

If you want to put environment variables in a central file (i.e. . bash_profile ) so that other programs can source them, then it should be pretty easy to get Tcl to parse that file and set the variables in the env array. Show activity on this post.

What is :: in Tcl?

Qualifiers are namespace names separated by double colons (::). For the string ::foo::bar::x, this command returns x, and for :: it returns an empty string. This command is the complement of the namespace qualifiers command.


1 Answers

There is an array called env that stores all the environment variables. So you can simply do this:

puts [array get env]

or simply

parray env
like image 106
TrojanName Avatar answered Sep 29 '22 21:09

TrojanName