environ - edit the environment variable list


environ StrExpr


Environ edits the environment variable list according to StrExpr.  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. 

StrExpr, and the environment variables, have the form "name=value" where name is the name of the variable and value is the value assigned to the variable.  If the name given in the statement matches the name of an entry in the environment variable list, the entry is first deleted.  Then if the value given in the statement is not empty, a new "name=value" entry is appended to the end of the environment variable list. 


We could add a new environment variable, ANIMAL, with the value "pig" to the environment list with the following statement:
	environ "ANIMAL=pig"
Then we could change the value of ANIMAL to "frog" with the following statement:
	environ "ANIMAL=frog"
Finally, we could delete the variable ANIMAL altogether with the following statement:
	environ "ANIMAL="
The following program changes the userís prompt and invokes a shell:
	environ "PS1=% "
	print "Creating a shell..."
	print "Ending shell"
The output of this program would look like the following if the user responds to the new shell with "exit":
	$ a.out
	Creating a shell...
	% exit
	Ending shell




If StrExpr is formatted improperly, an "Illegal function call" error is generated. 

from The Basmark QuickBASIC Programmerís Manual by Lawrence Leinweber