8

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

1 Answer 1

18

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 
Sign up to request clarification or add additional context in comments.

2 Comments

The difference between the two is that parray sorts the keys, does nice indentation, and otherwise generally makes the output easy to read. array get doesn't; it's intended mainly for serialization of an array's data (ready to use with array set).
puts [array get env] - for me this prints nothing at all ?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.