NAME

environ$ - read the environment variable list

SYNOPSIS

v$ = environ$(NumExpr)
v$ = environ$(StrExpr)

DESCRIPTION

Environ$ returns a string from the environment variable list given by the argument to the function.  An environment variable is a string which is automatically made available to new programs.  A change to the environment list in a BASIC program persists for the duration of the execution of the program and is made available to new programs that are invoked by the BASIC program.  The string returned is normally of the form "name=value" where name is the name of the variable and value is the value assigned to the variable. 

In the first case, the argument to the function is a numeric expression.  The string returned is the "name=value" entry selected by using the value of the expression as an index into the environment variable list.  If the value of the expression is too large the null string is returned. 

In the second case, the argument to the function is a string expression.  The string returned is the value associated with the environment variable whose name matched the name given by the string expression. 

EXAMPLE

The following program will print the current environment variable list:
	i = 1
	while environ$(i) <> ""
		print environ$(i)
		i = i + 1
	wend
The output might look like this:
	HOME=/usr/ljl
	PATH=:/bin:/usr/bin
	SHELL=/bin/sh
	TERM=tvi950
	TZ=EST5EDT
The following program will print the userís path:
	print environ$("PATH")
The output might look like this:
	:/bin:/usr/bin

SEE ALSO

environ(stmt)

DIAGNOSTICS

If the argument to the function is a numeric expression and is not positive or if the argument is a string and is empty or contains a blank, tab or equal sign, an "Illegal function call" error is generated. 

from The Basmark QuickBASIC Programmerís Manual by Lawrence Leinweber