github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/gen/includes/parser-var-tokens.inc.md (about)

     1  **ASCII variable names:**
     2  
     3  ```
     4  » $example = "foobar"
     5  » out $example
     6  foobar
     7  ```
     8  
     9  **Unicode variable names:**
    10  
    11  Variable names can be non-ASCII however they have to be surrounded by
    12  parenthesis. eg
    13  
    14  ```
    15  » $(比如) = "举手之劳就可以使办公室更加环保,比如,使用再生纸。"
    16  » out $(比如)
    17  举手之劳就可以使办公室更加环保,比如,使用再生纸。
    18  ```
    19  
    20  **Infixing inside text:**
    21  
    22  Sometimes you need to denote the end of a variable and have text follow on.
    23  
    24  ```
    25  » $partial_word = "orl"
    26  » out "Hello w$(partial_word)d!"
    27  Hello world!
    28  ```
    29  
    30  **Variables are tokens:**
    31  
    32  Please note the new line (`\n`) character. This is not split using `$`:
    33  
    34  ```
    35  » $example = "foo\nbar"
    36  ```
    37  
    38  Output as a string:
    39  
    40  ```
    41  » out $example
    42  foo
    43  bar
    44  ```
    45  
    46  Output as an array:
    47  
    48  ```
    49  » out @example
    50  foo bar
    51  ```
    52  
    53  The string and array tokens also works for subshells:
    54  
    55  ```
    56  » out ${ %[Mon..Fri] }
    57  ["Mon","Tue","Wed","Thu","Fri"]
    58  
    59  » out @{ %[Mon..Fri] }
    60  Mon Tue Wed Thu Fri
    61  ```
    62  
    63  > `out` will take an array and output each element, space delimited. Exactly
    64  > the same how `echo` would in Bash.
    65  
    66  **Variable as a command:**
    67  
    68  If a variable is used as a commend then Murex will just print the content of
    69  that variable.
    70  
    71  ```
    72  » $example = "Hello World!"
    73  
    74  » $example
    75  Hello World!
    76  ```