Difference between revisions of "Env"

From MiniScript Wiki
Jump to navigation Jump to search
(Created page with "In Mini Micro, <c>env</c> refers to a map of special values that affect the Mini Micro environment. It contains at least the following keys: {| class="wikitable" |- ! Ke...")
 
Line 1: Line 1:
 +
<c>env</c> is a built-in map in both [[Mini Micro]] and [[command-line MiniScript]].  It has somewhat different meaning and usage in each environment.
 +
 +
== Mini Micro ==
 +
 
In [[Mini Micro]], <c>env</c> refers to a map of special values that affect the Mini Micro environment.  It contains at least the following keys:
 
In [[Mini Micro]], <c>env</c> refers to a map of special values that affect the Mini Micro environment.  It contains at least the following keys:
  
Line 19: Line 23:
 
| morePrompt || [[string]] printed as the prompt when more input is needed
 
| morePrompt || [[string]] printed as the prompt when more input is needed
 
|}
 
|}
 +
 +
== Command-Line MiniScript ==
 +
 +
In [[command-line MiniScript]], <c>env</c> is a copy of the shell environment variables.  Assignments to entries of <c>env</c> add or update environment variables.  (Deleting environment variables is not possible; you may delete from the <c>env</c> map, but this does not actually affect the environment.)
 +
 +
The exact meaning of environment variables varies with the platform.  They have many uses, such as in [http://www.cgi101.com/book/ch3/text.html CGI scripts].
  
 
[[Category:Mini Micro]]
 
[[Category:Mini Micro]]
 +
[[Category:Command-Line MiniScript]]

Revision as of 20:01, 16 January 2021

env is a built-in map in both Mini Micro and command-line MiniScript. It has somewhat different meaning and usage in each environment.

Mini Micro

In Mini Micro, env refers to a map of special values that affect the Mini Micro environment. It contains at least the following keys:

Key Meaning
bootOpts a complete copy of the data in the bootOpts.grfon file
curdir current working directory (same as pwd)
cmdLine command line command that was used to launch Mini Micro (where applicable)
cmdLineArgs command line arguments (as a list) used when Mini Micro was launched (where applicable)
importPaths list of directories searched for import modules
prompt string printed as the command-line prompt
morePrompt string printed as the prompt when more input is needed

Command-Line MiniScript

In command-line MiniScript, env is a copy of the shell environment variables. Assignments to entries of env add or update environment variables. (Deleting environment variables is not possible; you may delete from the env map, but this does not actually affect the environment.)

The exact meaning of environment variables varies with the platform. They have many uses, such as in CGI scripts.