Skip to main content

Builtins Reference

Laurence MorganAbout 5 mincommands

Builtins Reference

This section is a glossary of Murex builtin commands.

Because Murex is loosely modelled on the functional paradigm, it means all language constructs are exposed via functions and those are typically builtins because they can share the Murex runtime virtual machine. However any executable command can also be called from within Murex; be that either via the exec builtin or natively like you would from any Linux, UNIX, or even Windows command prompt.

Other Reference Material

Language Guides

  1. Language Tour, which is an introduction into the Murex language.

  2. Rosetta Stone, which is a reference table comparing Bash syntax to Murex's.

Murex's Source Code

The source for each of these builtins can be found on Githubopen in new window.

Shell Commands For Querying Builtins

From the shell itself: run builtins to list the builtin command.

If you require a manual on any of those commands, you can run murex-docs to return the same markdown-formatted document as those listed below. eg

murex-docs trypipe

Pages

  • 2darray: Create a 2D JSON array from multiple input sources
  • <stdin>: Read the STDIN belonging to the parent code block
  • @g (autoglob) : Command prefix to expand globbing (deprecated)
  • a (mkarray): A sophisticated yet simple way to build an array or list
  • addheading: Adds headings to a table
  • alias: Create an alias for a command
  • alter: Change a value within a structured data-type and pass that change along the pipeline without altering the original source input
  • and: Returns true or false depending on whether multiple conditions are met
  • append: Add data to the end of an array
  • args: Command line flag parser for Murex shell scripting
  • autocomplete: Set definitions for tab-completion in the command line
  • bexists: Check which builtins exist
  • bg: Run processes in the background
  • break: Terminate execution of a block within your processes scope
  • cast: Alters the data type of the previous function without altering it's output
  • catch: Handles the exception code raised by try or trypipe
  • cd: Change (working) directory
  • config: Query or define Murex runtime settings
  • continue: Terminate process of a block within a caller function
  • count: Count items in a map, list or array
  • cpuarch: Output the hosts CPU architecture
  • cpucount: Output the number of CPU cores available on your host
  • datetime: A date and/or time conversion tool (like printf but for date and time values)
  • debug: Debugging information
  • die: Terminate murex with an exit number of 1
  • err: Print a line to the STDERR
  • escape: Escape or unescape input
  • esccli: Escapes an array so output is valid shell code
  • eschtml: Encode or decodes text for HTML
  • escurl: Encode or decodes text for the URL
  • event: Event driven programming for shell scripts
  • exec: Runs an executable
  • exit: Exit murex
  • exitnum: Output the exit number of the previous process
  • export: Define an environmental variable and set it's value
  • expr: Expressions: mathematical, string comparisons, logical operators
  • f: Lists or filters file system objects (eg files)
  • false: Returns a false value
  • fexec: Execute a command or function, bypassing the usual order of precedence.
  • fg: Sends a background process into the foreground
  • fid-kill: Terminate a running Murex function
  • fid-killall: Terminate all running Murex functions
  • fid-list: Lists all running functions within the current Murex session
  • for: A more familiar iteration loop to existing developers
  • foreach: Iterate through an array
  • formap: Iterate through a map or other collection of data
  • format: Reformat one data-type into another data-type
  • function: Define a function block
  • g: Glob pattern matching for file system objects (eg *.txt)
  • get-type: Returns the data-type of a variable or pipe
  • get: Makes a standard HTTP request and returns the result as a JSON object
  • getfile: Makes a standard HTTP request and return the contents as Murex-aware data type for passing along Murex pipelines.
  • global: Define a global variable and set it's value
  • history: Outputs murex's command history
  • if: Conditional statement to execute different blocks of code depending on the result of the condition
  • is-null: Checks if a variable is null or undefined
  • ja (mkarray): A sophisticated yet simply way to build a JSON array
  • jsplit: Splits STDIN into a JSON array based on a regex parameter
  • left: Left substring every item in a list
  • let: Evaluate a mathematical function and assign to variable (deprecated)
  • lockfile: Create and manage lock files
  • man-get-flags: Parses man page files for command line flags
  • man-summary: Outputs a man page summary of a command
  • map: Creates a map from two data sources
  • match: Match an exact value in an array
  • method: Define a methods supported data-types
  • msort: Sorts an array - data type agnostic
  • mtac: Reverse the order of an array
  • murex-docs: Displays the man pages for Murex builtins
  • murex-package: Murex's package manager
  • murex-parser: Runs the Murex parser against a block of code
  • murex-update-exe-list: Forces Murex to rescan $PATH looking for executables
  • null: null function. Similar to /dev/null
  • open-image: Renders bitmap image data on your terminal
  • open: Open a file with a preferred handler
  • openagent: Creates a handler function for open
  • or: Returns true or false depending on whether one code-block out of multiple ones supplied is successful or unsuccessful.
  • os: Output the auto-detected OS name
  • out: Print a string to the STDOUT with a trailing new line character
  • pipe: Manage Murex named pipes
  • post: HTTP POST request with a JSON-parsable return
  • prefix: Prefix a string to every item in a list
  • prepend: Add data to the start of an array
  • pretty: Prettifies JSON to make it human readable
  • private: Define a private function block
  • pt: Pipe telemetry. Writes data-types and bytes written
  • rand: Random field generator
  • read: read a line of input from the user and store as a variable
  • regexp: Regexp tools for arrays / lists of strings
  • return: Exits current function scope
  • right: Right substring every item in a list
  • round: Round a number by a user defined precision
  • runmode: Alter the scheduler's behaviour at higher scoping level
  • runtime: Returns runtime information on the internal state of Murex
  • rx: Regexp pattern matching for file system objects (eg .*\\.txt)
  • set: Define a local variable and set it's value
  • signal: Sends a signal RPC
  • source: Import Murex code from another file of code block
  • struct-keys: Outputs all the keys in a structure as a file path
  • suffix: Prefix a string to every item in a list
  • summary: Defines a summary help text for a command
  • switch: Blocks of cascading conditionals
  • ta (mkarray): A sophisticated yet simple way to build an array of a user defined data-type
  • tabulate: Table transformation tools
  • test: Murex's test framework - define tests, run tests and debug shell scripts
  • time: Returns the execution run time of a command or block
  • tmp: Create a temporary file and write to it
  • tout: Print a string to the STDOUT and set it's data-type
  • tread: read a line of input from the user and store as a user defined typed variable (deprecated)
  • true: Returns a true value
  • try: Handles non-zero exits inside a block of code
  • tryerr: Handles errors inside a block of code
  • trypipe: Checks for non-zero exits of each function in a pipeline
  • trypipeerr: Checks state of each function in a pipeline and exits block on error
  • type: Command type (function, builtin, alias, etc)
  • unsafe: Execute a block of code, always returning a zero exit number
  • version: Get Murex version
  • which: Locate command origin
  • while: Loop until condition false

Optional Builtins

  • !bz2: Decompress a bz2 file
  • base64: Encode or decode a base64 string
  • gz: Compress or decompress a gzip file
  • qr: Creates a QR code from STDIN
  • select: Inlining SQL into shell pipelines
  • sleep: Suspends the shell for a number of seconds