|
From: | Stephen |
Subject: | Re: [Help-smalltalk] How to access environment variables ? |
Date: | Thu, 15 Jan 2009 16:15:02 +1300 |
User-agent: | Thunderbird 2.0.0.19 (Macintosh/20081209) |
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
[Prev in Thread] | Current Thread | [Next in Thread] |