Mehul N. Sanghvi wrote:
I would like to be able to get at all of the environment variables
(whether it is the shell environment variables or the CGI environment
variables or something else). What object/class would I use for that ?
There is a way of getting it with an OS call...
$ gst
GNU Smalltalk ready
st> | pipe |
st> pipe := FileStream popen: 'set' dir: FileStream read
<Pipe on set>
st> pipe contents
'AUTO_SYMLINK=no
BASH=/bin/sh
BASH_ARGC=()
BASH_ARGV=()
BASH_EXECUTION_STRING=set
BASH_LINENO=()
BASH_SOURCE=()
....
In code, something like:
osCall: cmd [
| pipe |
pipe := FileStream popen: cmd dir: FileStream read.
^pipe contents.
]
Then call it like:-
Transcript show: (osCall: 'set').
or
Transcript show: (osCall: 'ls -l').
Stephen