ENV() Function - Get O/S Environment Variables

Syntax

ENV(str{,IND=int}{,ERR=lineref})

Description

In BBj 4.0 and higher, the ENV() function returns the value of a specified operating system environment variable.

Parameter

Description

str

Operating system environment variable.

IND=int

IND=0 forces the variable lookup to be case-sensitive.

IND=1 forces the variable lookup to be case-insensitive.

If this parameter is omitted, the variable lookup is case-sensitive on UNIX and Linux and case-insensitive on Windows.

ERR=lineref

Branch taken if an error occurs during execution.

If the specified environment variable does not exist, an !ERROR 11 is returned.

Remarks

By default, the ENV() function returns the environment of the server. In BBj 4.0 and higher, this can be changed to return the environment of the client by setting SETOPTS bit 8, $08$.

Examples

REM ' Retrieve the name of the Windows command processor
PRINT ENV("COMSPEC")

C:\WINNT\SYSTEM32\CMD.EXE

REM ' Retrieve the name of the shell on UNIX or Linux
PRINT ENV("SHELL")

/bin/ksh

See Also

Functions - Alphabetical Listing



______________________________________________________________________________________

Copyright BASIS International Ltd. BBj®, Visual PRO/5®, PRO/5®, and BBx® are registered trademarks.