Special Variables
Special Variables
Variables are typed.
They can be a primitive like int
or str
. They can also be a structured document like json
, csv
or sexpr
.
Variables can also have a string representation, for compatibility with older POSIX idioms, as well as a native object format.
Glossary Of Terms
To help better understand how variables work under the hood, blow is a glossary of terms:
primitive: this refers to the atomic component of a data-type. In other words, the smallest possible format for a piece of data. Where a JSON file might arrays and maps, the values for those objects cannot be divided any smaller than numbers, strings or a small number of constants like
true
,false
, andnull
.scope: this is how far outside the code block that a particular variable can be written to, or read from.
local (scope): this refers to variables that cannot be read nor modified outside of the current function. Thus one function cannot read nor write to a variable in another function.
module (scope): these variables are accessible by any function or routine from within the same module. You'll only need module scoped variables if you're writing modules -- and even then, only if you want that variable available to all functions within that module.
global (scope): these are variables which are accessible from any function, anywhere within Murex.
environmental variables: sometimes written as env vars for short, these are system variables. They can be passed from one process to another, so careful what secrets you store and what software you run while you have sensitive env vars defined.
reserved variables: this refers to variables that are read only. Some reserved variables are dynamic and thus can change their value depending on contextual circumstances.
POSIX: this is a specification that Linux, Apple macOS, FreeBSD and its ilk follow. It defines a lot of the commonality between these environments. Windows and Plan 9 are not POSIX-compatible out-of-the-box but can support POSIX (eg via WSL).
Pages
- Numeric (str): Variables who's name is a positive integer, eg
0
,1
,2
,3
and above $.
, Meta Values (json): State information for iteration blocksARGV
(json): Array of the command name and parameters within a given scopeCOLUMNS
(int): Character width of terminalEVENT_RETURN
(json): Return values for eventsHOME
(path): Return the home directory for the current session userHOSTNAME
(str): Hostname of the current machineLINES
(int): Character height of terminalLOGNAME
(str): Username for the current session (historic)MUREX_ARGV
(json): Array of the command name and parameters passed to the current shellMUREX_CONFIG_DIR
(str): Defines the path to Murex's configMUREX_EXE
(path): Absolute path to running shellMUREX_HISTORY
(str): Defines the path to the.murex_history
logMUREX_MODULES
(str): Defines the path to the modules directoryMUREX_PRELOAD
(str): Defines the path to the.murex_preload
scriptMUREX_PROFILE
(str): Defines the path to the.murex_profile
scriptOLDPWD
(path): Return the home directory for the current session userPARAMS
(json): Array of the parameters within a given scopePWDHIST
(json): History of each change to the sessions working directoryPWD
(path): Current working directoryRANDOM
(int): Return a random 32-bit integer (historical)SELF
(json): Meta information about the running scope.SHELL
(str): Path of current shellTMPDIR
(path): Return the temporary directoryUSER
(str): Username for the current session