github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/docs/commands/source.md (about) 1 # `source` 2 3 > Import Murex code from another file of code block 4 5 ## Description 6 7 `source` imports code from another file or code block. It can be used as either 8 an "import" / "include" directive (eg Python, Go, C, etc) or an "eval" (eg 9 Python, Perl, etc). 10 11 ## Usage 12 13 Execute source from STDIN 14 15 ``` 16 <stdin> -> source 17 ``` 18 19 Execute source from a file 20 21 ``` 22 source filename.mx 23 ``` 24 25 Execute a code block from parameter 26 27 ``` 28 source { code-block } 29 ``` 30 31 ## Examples 32 33 Execute source from stdin: 34 35 ``` 36 » tout block { out "Hello, world!" } -> source 37 Hello, world! 38 ``` 39 40 Execute source from file: 41 42 ``` 43 » tout block { out "Hello, world!" } |> example.mx 44 » source example.mx 45 Hello, world! 46 ``` 47 48 Execute a code block from parameter 49 50 ``` 51 » source { out "Hello, world!" } 52 Hello, world! 53 ``` 54 55 ## Synonyms 56 57 * `source` 58 * `.` 59 60 61 ## See Also 62 63 * [`args` ](../commands/args.md): 64 Command line flag parser for Murex shell scripting 65 * [`autocomplete`](../commands/autocomplete.md): 66 Set definitions for tab-completion in the command line 67 * [`config`](../commands/config.md): 68 Query or define Murex runtime settings 69 * [`exec`](../commands/exec.md): 70 Runs an executable 71 * [`fexec` ](../commands/fexec.md): 72 Execute a command or function, bypassing the usual order of precedence. 73 * [`function`](../commands/function.md): 74 Define a function block 75 * [`murex-parser` ](../commands/murex-parser.md): 76 Runs the Murex parser against a block of code 77 * [`private`](../commands/private.md): 78 Define a private function block 79 * [`runtime`](../commands/runtime.md): 80 Returns runtime information on the internal state of Murex 81 * [`version`](../commands/version.md): 82 Get Murex version 83 84 <hr/> 85 86 This document was generated from [builtins/core/management/source_doc.yaml](https://github.com/lmorg/murex/blob/master/builtins/core/management/source_doc.yaml).