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 Sep 18 21:18:57 UTC 2024 against commit c037883c03788357164e9846c84d9f777251495d9452a8e.
Current version is 6.3.4225 (develop) which has been verified against tests cases.