SELF
(json)Meta information about the running scope.
SELF
returns information about the functional scope that
the code is running inside. Such as whether that functions stdout is a
TTY, running in the background or a method.
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 read the scoping document for more information on scoping.
This is a reserved variable so it cannot be changed.
» function example { $SELF }
» example
{
"Background": false,
"Interactive": true,
"Method": false,
"Module": "murex/shell",
"Not": false,
"Parent": 834,
"Scope": 834,
"TTY": true
}
A boolean value to identify whether the current scope is running in the background for foreground.
A boolean value to describe whether the current scope is running interactively or not.
An interactive scope is one where the shell prompt is running and the scope isn’t running in the background. Shell scripts are not considered interactive terminals even though they might have interactive element in their code.
A boolean value to describe whether the current scope is a method (ie being called mid-way or at the end of a pipeline).
This will be the module string for the current scope.
A boolean value which represents whether the function was called with a bang- prefix or not.
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.
The scope value here returns the function ID of the top level function in the scope.
A boolean value as to whether stdout is a TTY (ie are we printing to the terminal (TTY) or a pipe?)
function
): Define a function blockjson
: JavaScript Object
Notation (JSON)str
(string): string
(primitive)This document was generated from gen/variables/SELF_doc.yaml.
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 Wed Jul 2 22:12:32 UTC 2025 against commit bb72b6fbb72b6fdd502f835172d7d06207ba4ec2c70886c.
Current version is 7.0.2107 (develop) which has been verified against tests cases.