murex Shell Docs

User Guide: Reserved Variables

Special variables reserved by murex

murex reserves a few special variables which cannot be assigned via set nor let.

The following is a list of reserved variables, their data type, and its usage:

SELF (json)

This returns meta information about the running scope.

A 'scope' in murex is a collection of code blocks to which variables and config are persistent within. In murex, a variable declared inside an if or foreach block will be persistent outside of their blocks as long as you're still inside the same function.

Please see scoping document (link below) for more information on scoping.

» function example { out $SELF }
» example
    "Parent": 11357,
    "Scope": 11357,
    "TTY": true,
    "Method": false,
    "Not": false,
    "Background": false,
    "Module": "murex"

Parent (num)

This is the function ID of the parent function that created the scope. In some instances this will be the same value as scope FID. However if in doubt then please using Scope instead.

Scope (num)

The scope value here returns the function ID of the top level function in the scope.

TTY (bool)

A boolean value as to whether STDOUT is a TTY (ie are we printing to the terminal (TTY) or a pipe?)

Method (bool)

A boolean value to describe whether the current scope is a method (ie being called mid-way or at the end of a pipeline).

Not (bool)

A boolean value which represents whether the function was called with a bang- prefix or not.

Background (bool)

A boolean value to identify whether the current scope is running in the background for foreground.

Module (str)

This will be the module string for the current scope.

ARGS (json)

This returns a JSON array of the command name and parameters within a given scope.

» function example { out $ARGS }
» example abc 1 2 3


This is very similar to the $SHELL environmental variable in that it holds the full path to the running shell. The reason for defining a reserved variable is so that the shell path cannot be overridden.


This is TODO:

See Also

This site's content is rebuilt automatically from murex's source code after each merge to the master branch. Downloadable murex binaries are also built with the website.

Last built on Tue Jun 22 08:18:17 UTC 2021 against commit 2235c7b2235c7b18f86f1cf214e246b88b0ea193d87fe80.

Current version is 2.2.1100 BETA which has been verified against tests.