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

     1  # `err`
     2  
     3  > Print a line to the STDERR
     4  
     5  ## Description
     6  
     7  Write parameters to STDERR with a trailing new line character.
     8  
     9  ## Usage
    10  
    11  ```
    12  err string to write -> <stderr>
    13  ```
    14  
    15  ## Examples
    16  
    17  ```
    18  » err Hello, World!
    19  Hello, World!
    20  ```
    21  
    22  ## Detail
    23  
    24  `err` outputs as `string` data-type. This can be changed by casting
    25  
    26  ```
    27  err { "Code": 404, "Message": "Page not found" } ? cast json
    28  ```
    29  
    30  However passing structured data-types along the STDERR stream is not recommended
    31  as any other function within your code might also pass error messages along the
    32  same stream and thus taint your structured data. This is why Murex does not
    33  supply a `tout` function for STDERR. The recommended solution for passing
    34  messages like these which you want separate from your STDOUT stream is to create
    35  a new Murex named pipe.
    36  
    37  ```
    38  » pipe --create messages
    39  » bg { <messages> -> pretty }
    40  » tout <messages> json { "Code": 404, "Message": "Page not found" }
    41  » pipe --close messages
    42  {
    43      "Code": 404,
    44      "Message": "Page not found"
    45  }
    46  ```
    47  
    48  ### ANSI Constants
    49  
    50  `err` supports ANSI constants.
    51  
    52  ## See Also
    53  
    54  * [ANSI Constants](../user-guide/ansi.md):
    55    Infixed constants that return ANSI escape sequences
    56  * [`(brace quote)`](../parser/brace-quote-func.md):
    57    Write a string to the STDOUT without new line (deprecated)
    58  * [`<read-named-pipe>`](../parser/namedpipe.md):
    59    Reads from a Murex named pipe
    60  * [`>>` Append File](../parser/greater-than-greater-than.md):
    61    Writes STDIN to disk - appending contents if file already exists
    62  * [`bg`](../commands/bg.md):
    63    Run processes in the background
    64  * [`cast`](../commands/cast.md):
    65    Alters the data type of the previous function without altering it's output
    66  * [`out`](../commands/out.md):
    67    Print a string to the STDOUT with a trailing new line character
    68  * [`pipe`](../commands/pipe.md):
    69    Manage Murex named pipes
    70  * [`pretty`](../commands/pretty.md):
    71    Prettifies JSON to make it human readable
    72  * [`pt`](../commands/pt.md):
    73    Pipe telemetry. Writes data-types and bytes written
    74  * [`tout`](../commands/tout.md):
    75    Print a string to the STDOUT and set it's data-type
    76  * [`|>` Truncate File](../parser/greater-than.md):
    77    Writes STDIN to disk - overwriting contents if file already exists
    78  
    79  <hr/>
    80  
    81  This document was generated from [builtins/core/io/echo_doc.yaml](https://github.com/lmorg/murex/blob/master/builtins/core/io/echo_doc.yaml).