Gri Commands
|
12.14: The `
|
`get env \result \environment_variable' |
Get the value of an "environment variable" from the unix operating system,
and store the result in the indicated synonym. This makes most sense on
unix systems (hence the name, patterned after the unix command
`getenv
'). This command can be useful in making gri programs
resistant to changes in data-file locations. Suppose, for example,
there is a file called `data', normally in a local directory called
`Bravo
'. The line `open Bravo/data
' will fail if the Bravo
directory is moved. But if the name of the datafile is stored in an
unix environment variable, `DIR_BRAVO
' say, then the gri program will
work no matter where the Bravo data are moved, so long as an appropriate
environment variable is modified when the data are moved. Example:
get env \dir DIR_BRAVO if {rpn "\dir" "" ==} show "Cannot determine location of the Bravo data," show "which should be stored in the environment" show "variable DIR_BRAVO. You should" show "do something like" show "export DIR_BRAVO='/data/Bravo/'" show "in your ~/.environment file" quit |