The GETENV function returns the equivalence string for Name from the environment of the IDL process. If Name does not exist in the environment, a null string is returned.
VMS does not directly support the concept of environment variables. Instead, it is emulated (by using the standard C getenv() function) as described below, enabling you to use GETENV portably between Unix and VMS:
Every Unix process has an "environment." The environment consists of "environment variables," each of which has a string value associated with it. Some environment variables always exist, such as PATH that tells the shell where to look for programs or TERM that specifies the kind of terminal being used. Others can be added by the user, usually from an interactive shell and often from the .login file that is executed when you log in.
When a process is created, it is given a copy of the environment from its parent process. IDL is no exception to this; when started, it inherits a copy of its parent's environment. The parent process to IDL is usually the interactive shell from which it was started. In turn, any child process created by IDL (such as those from the SPAWN procedure) inherits a copy of IDL's current environment.
NOTE: It is important to realize that environment variables are not an IDL feature; they are part of every Unix process. Although they can serve as a form of global memory, it is best to avoid using them in that way. Instead, IDL heap variables (pointers or object references), IDL system variables, or common blocks should be used in that role. This will make your IDL code portable to non-Unix-based IDL systems. Environment variables should be used for communicating with child processes. One example is setting the value of the SHELL environment variable prior to calling SPAWN to change the shell executed by SPAWN.
where Name is the name of the environment variable for which the translation is desired. If Name does not exist in the environment, a null string is returned. For example, to determine the type of terminal being used, you can enter the IDL statement: