github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/docs/commands/README.md (about)

     1  # Builtins Reference
     2  
     3  This section is a glossary of Murex builtin commands.
     4  
     5  Because Murex is loosely modelled on the functional paradigm, it means
     6  all language constructs are exposed via functions and those are typically
     7  builtins because they can share the Murex runtime virtual machine.
     8  However any executable command can also be called from within Murex;
     9  be that either via the `exec` builtin or natively like you would from any
    10  Linux, UNIX, or even Windows command prompt.
    11  
    12  ## Other Reference Material
    13  
    14  ### Language Guides
    15  
    16  1. [Language Tour](/docs/tour.md), which is an introduction into
    17      the Murex language.
    18  
    19  2. [Rosetta Stone](/docs/user-guide/rosetta-stone.md), which is a reference
    20      table comparing Bash syntax to Murex's.
    21  
    22  ### Murex's Source Code
    23  
    24  The source for each of these builtins can be found on [Github](https://github.com/lmorg/murex/tree/master/builtins/core).
    25  
    26  ### Shell Commands For Querying Builtins
    27  
    28  From the shell itself: run `builtins` to list the builtin command.
    29  
    30  If you require a manual on any of those commands, you can run `murex-docs`
    31  to return the same markdown-formatted document as those listed below. eg
    32  
    33  ```
    34  murex-docs trypipe
    35  ```  
    36  
    37  ## Pages
    38  
    39  * [`2darray` ](../commands/2darray.md):
    40    Create a 2D JSON array from multiple input sources
    41  * [`<stdin>`](../commands/stdin.md):
    42    Read the STDIN belonging to the parent code block
    43  * [`@g` (autoglob) ](../commands/autoglob.md):
    44    Command prefix to expand globbing (deprecated)
    45  * [`a` (mkarray)](../commands/a.md):
    46    A sophisticated yet simple way to build an array or list
    47  * [`addheading` ](../commands/addheading.md):
    48    Adds headings to a table
    49  * [`alias`](../commands/alias.md):
    50    Create an alias for a command
    51  * [`alter`](../commands/alter.md):
    52    Change a value within a structured data-type and pass that change along the pipeline without altering the original source input
    53  * [`and`](../commands/and.md):
    54    Returns `true` or `false` depending on whether multiple conditions are met
    55  * [`append`](../commands/append.md):
    56    Add data to the end of an array
    57  * [`args` ](../commands/args.md):
    58    Command line flag parser for Murex shell scripting
    59  * [`autocomplete`](../commands/autocomplete.md):
    60    Set definitions for tab-completion in the command line
    61  * [`bexists`](../commands/bexists.md):
    62    Check which builtins exist
    63  * [`bg`](../commands/bg.md):
    64    Run processes in the background
    65  * [`break`](../commands/break.md):
    66    Terminate execution of a block within your processes scope
    67  * [`cast`](../commands/cast.md):
    68    Alters the data type of the previous function without altering it's output
    69  * [`catch`](../commands/catch.md):
    70    Handles the exception code raised by `try` or `trypipe`
    71  * [`cd`](../commands/cd.md):
    72    Change (working) directory
    73  * [`config`](../commands/config.md):
    74    Query or define Murex runtime settings
    75  * [`continue`](../commands/continue.md):
    76    Terminate process of a block within a caller function
    77  * [`count`](../commands/count.md):
    78    Count items in a map, list or array
    79  * [`cpuarch`](../commands/cpuarch.md):
    80    Output the hosts CPU architecture
    81  * [`cpucount`](../commands/cpucount.md):
    82    Output the number of CPU cores available on your host
    83  * [`datetime`](../commands/datetime.md):
    84    A date and/or time conversion tool (like `printf` but for date and time values)
    85  * [`debug`](../commands/debug.md):
    86    Debugging information
    87  * [`die`](../commands/die.md):
    88    Terminate murex with an exit number of 1
    89  * [`err`](../commands/err.md):
    90    Print a line to the STDERR
    91  * [`escape`](../commands/escape.md):
    92    Escape or unescape input
    93  * [`esccli`](../commands/esccli.md):
    94    Escapes an array so output is valid shell code
    95  * [`eschtml`](../commands/eschtml.md):
    96    Encode or decodes text for HTML
    97  * [`escurl`](../commands/escurl.md):
    98    Encode or decodes text for the URL
    99  * [`event`](../commands/event.md):
   100    Event driven programming for shell scripts
   101  * [`exec`](../commands/exec.md):
   102    Runs an executable
   103  * [`exit`](../commands/exit.md):
   104    Exit murex
   105  * [`exitnum`](../commands/exitnum.md):
   106    Output the exit number of the previous process
   107  * [`export`](../commands/export.md):
   108    Define an environmental variable and set it's value
   109  * [`expr`](../commands/expr.md):
   110    Expressions: mathematical, string comparisons, logical operators
   111  * [`f`](../commands/f.md):
   112    Lists or filters file system objects (eg files)
   113  * [`false`](../commands/false.md):
   114    Returns a `false` value
   115  * [`fexec` ](../commands/fexec.md):
   116    Execute a command or function, bypassing the usual order of precedence.
   117  * [`fg`](../commands/fg.md):
   118    Sends a background process into the foreground
   119  * [`fid-kill`](../commands/fid-kill.md):
   120    Terminate a running Murex function
   121  * [`fid-killall`](../commands/fid-killall.md):
   122    Terminate _all_ running Murex functions
   123  * [`fid-list`](../commands/fid-list.md):
   124    Lists all running functions within the current Murex session
   125  * [`for`](../commands/for.md):
   126    A more familiar iteration loop to existing developers
   127  * [`foreach`](../commands/foreach.md):
   128    Iterate through an array
   129  * [`formap`](../commands/formap.md):
   130    Iterate through a map or other collection of data
   131  * [`format`](../commands/format.md):
   132    Reformat one data-type into another data-type
   133  * [`function`](../commands/function.md):
   134    Define a function block
   135  * [`g`](../commands/g.md):
   136    Glob pattern matching for file system objects (eg `*.txt`)
   137  * [`get-type`](../commands/get-type.md):
   138    Returns the data-type of a variable or pipe
   139  * [`get`](../commands/get.md):
   140    Makes a standard HTTP request and returns the result as a JSON object
   141  * [`getfile`](../commands/getfile.md):
   142    Makes a standard HTTP request and return the contents as Murex-aware data type for passing along Murex pipelines.
   143  * [`global`](../commands/global.md):
   144    Define a global variable and set it's value
   145  * [`history`](../commands/history.md):
   146    Outputs murex's command history
   147  * [`if`](../commands/if.md):
   148    Conditional statement to execute different blocks of code depending on the result of the condition
   149  * [`is-null`](../commands/is-null.md):
   150    Checks if a variable is null or undefined
   151  * [`ja` (mkarray)](../commands/ja.md):
   152    A sophisticated yet simply way to build a JSON array
   153  * [`jsplit` ](../commands/jsplit.md):
   154    Splits STDIN into a JSON array based on a regex parameter
   155  * [`left`](../commands/left.md):
   156    Left substring every item in a list
   157  * [`let`](../commands/let.md):
   158    Evaluate a mathematical function and assign to variable (deprecated)
   159  * [`lockfile`](../commands/lockfile.md):
   160    Create and manage lock files
   161  * [`man-get-flags` ](../commands/man-get-flags.md):
   162    Parses man page files for command line flags 
   163  * [`man-summary`](../commands/man-summary.md):
   164    Outputs a man page summary of a command
   165  * [`map`](../commands/map.md):
   166    Creates a map from two data sources
   167  * [`match`](../commands/match.md):
   168    Match an exact value in an array
   169  * [`method`](../commands/method.md):
   170    Define a methods supported data-types
   171  * [`msort`](../commands/msort.md):
   172    Sorts an array - data type agnostic
   173  * [`mtac`](../commands/mtac.md):
   174    Reverse the order of an array
   175  * [`murex-docs`](../commands/murex-docs.md):
   176    Displays the man pages for Murex builtins
   177  * [`murex-package`](../commands/murex-package.md):
   178    Murex's package manager
   179  * [`murex-parser` ](../commands/murex-parser.md):
   180    Runs the Murex parser against a block of code 
   181  * [`murex-update-exe-list`](../commands/murex-update-exe-list.md):
   182    Forces Murex to rescan $PATH looking for executables
   183  * [`null`](../commands/devnull.md):
   184    null function. Similar to /dev/null
   185  * [`open-image`](../commands/open-image.md):
   186    Renders bitmap image data on your terminal
   187  * [`open`](../commands/open.md):
   188    Open a file with a preferred handler
   189  * [`openagent`](../commands/openagent.md):
   190    Creates a handler function for `open`
   191  * [`or`](../commands/or.md):
   192    Returns `true` or `false` depending on whether one code-block out of multiple ones supplied is successful or unsuccessful.
   193  * [`os`](../commands/os.md):
   194    Output the auto-detected OS name
   195  * [`out`](../commands/out.md):
   196    Print a string to the STDOUT with a trailing new line character
   197  * [`pipe`](../commands/pipe.md):
   198    Manage Murex named pipes
   199  * [`post`](../commands/post.md):
   200    HTTP POST request with a JSON-parsable return
   201  * [`prefix`](../commands/prefix.md):
   202    Prefix a string to every item in a list
   203  * [`prepend`](../commands/prepend.md):
   204    Add data to the start of an array
   205  * [`pretty`](../commands/pretty.md):
   206    Prettifies JSON to make it human readable
   207  * [`private`](../commands/private.md):
   208    Define a private function block
   209  * [`pt`](../commands/pt.md):
   210    Pipe telemetry. Writes data-types and bytes written
   211  * [`rand`](../commands/rand.md):
   212    Random field generator
   213  * [`read`](../commands/read.md):
   214    `read` a line of input from the user and store as a variable
   215  * [`regexp`](../commands/regexp.md):
   216    Regexp tools for arrays / lists of strings
   217  * [`return`](../commands/return.md):
   218    Exits current function scope
   219  * [`right`](../commands/right.md):
   220    Right substring every item in a list
   221  * [`round`](../commands/round.md):
   222    Round a number by a user defined precision
   223  * [`runmode`](../commands/runmode.md):
   224    Alter the scheduler's behaviour at higher scoping level
   225  * [`runtime`](../commands/runtime.md):
   226    Returns runtime information on the internal state of Murex
   227  * [`rx`](../commands/rx.md):
   228    Regexp pattern matching for file system objects (eg `.*\\.txt`)
   229  * [`set`](../commands/set.md):
   230    Define a local variable and set it's value
   231  * [`signal`](../commands/signal.md):
   232    Sends a signal RPC
   233  * [`source`](../commands/source.md):
   234    Import Murex code from another file of code block
   235  * [`struct-keys`](../commands/struct-keys.md):
   236    Outputs all the keys in a structure as a file path
   237  * [`suffix`](../commands/suffix.md):
   238    Prefix a string to every item in a list
   239  * [`summary` ](../commands/summary.md):
   240    Defines a summary help text for a command
   241  * [`switch`](../commands/switch.md):
   242    Blocks of cascading conditionals
   243  * [`ta` (mkarray)](../commands/ta.md):
   244    A sophisticated yet simple way to build an array of a user defined data-type
   245  * [`tabulate`](../commands/tabulate.md):
   246    Table transformation tools
   247  * [`test`](../commands/test.md):
   248    Murex's test framework - define tests, run tests and debug shell scripts
   249  * [`time`](../commands/time.md):
   250    Returns the execution run time of a command or block
   251  * [`tmp`](../commands/tmp.md):
   252    Create a temporary file and write to it
   253  * [`tout`](../commands/tout.md):
   254    Print a string to the STDOUT and set it's data-type
   255  * [`tread`](../commands/tread.md):
   256    `read` a line of input from the user and store as a user defined *typed* variable (deprecated)
   257  * [`true`](../commands/true.md):
   258    Returns a `true` value
   259  * [`try`](../commands/try.md):
   260    Handles non-zero exits inside a block of code
   261  * [`tryerr`](../commands/tryerr.md):
   262    Handles errors inside a block of code
   263  * [`trypipe`](../commands/trypipe.md):
   264    Checks for non-zero exits of each function in a pipeline
   265  * [`trypipeerr`](../commands/trypipeerr.md):
   266    Checks state of each function in a pipeline and exits block on error
   267  * [`type`](../commands/type.md):
   268    Command type (function, builtin, alias, etc)
   269  * [`unsafe`](../commands/unsafe.md):
   270    Execute a block of code, always returning a zero exit number
   271  * [`version`](../commands/version.md):
   272    Get Murex version
   273  * [`which`](../commands/which.md):
   274    Locate command origin
   275  * [`while`](../commands/while.md):
   276    Loop until condition false
   277  
   278  ## Optional Builtins
   279  
   280  * [`!bz2`](../optional/bz2.md):
   281    Decompress a bz2 file
   282  * [`base64` ](../optional/base64.md):
   283    Encode or decode a base64 string
   284  * [`gz`](../optional/gz.md):
   285    Compress or decompress a gzip file
   286  * [`qr`](../optional/qr.md):
   287    Creates a QR code from STDIN
   288  * [`select`](../optional/select.md):
   289    Inlining SQL into shell pipelines
   290  * [`sleep`](../optional/sleep.md):
   291    Suspends the shell for a number of seconds