github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/builtins/core/io/tmp_doc.yaml (about)

     1  - DocumentID: tmp
     2    Title: >+
     3      `tmp`
     4    CategoryID: commands
     5    Summary: >-
     6      Create a temporary file and write to it
     7    Description: |-
     8      `tmp` creates a temporary file, writes the contents of STDIN to it then returns
     9      its filename to STDOUT.
    10  
    11      You can optionally specify a file extension, for example if the temporary file
    12      needs to be read by `open` or an editor which uses extensions to define syntax
    13      highlighting.
    14    Usage: |-
    15      ```
    16      <stdin> -> tmp [ file-extension ] -> <stdout>
    17      ```
    18    Examples: |-
    19      ```
    20      » out "Hello, world!" -> set tmp
    21      
    22      » out $tmp
    23      /var/folders/3t/267q_b0j27d29bnf6pf7m7vm0000gn/T/murex838290600/8ec6936c1ac1c347bf85675eab4a0877-13893
    24      
    25      » open $tmp
    26      Hello, world!
    27      ```
    28    Detail: |-
    29      The temporary file name is a base64 encoded md5 hash of the time plus Murex
    30      function ID with Murex process ID appended:
    31  
    32      ```go
    33      {{ include "builtins/core/io/tmp.go" }}
    34      ```
    35  
    36      This should should provide enough distance to run `tmp` in parallel....should
    37      you ever want to.
    38      
    39      `tmp` files are also located inside a unique per-process Murex temp directory
    40      which itself is located in the appropriate temp directory for the host OS (eg
    41      `$TMPDIR` on macOS).
    42    Synonyms:
    43    Related:
    44      - open
    45      - greater-than
    46      - greater-than-greater-than
    47      - pipe