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.
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_EXE
(path): Absolute path to running shellOLDPWD
(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