github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/docs/parser/pipe-append.md (about) 1 # `>>` Append Pipe 2 3 > Redirects STDOUT to a file and append its contents 4 5 ## Description 6 7 This is used to redirect the STDOUT of a command and append it to a file. If 8 that file does not exist, then the file is created. 9 10 This behaves similarly to the [Bash (et al) token](https://www.gnu.org/software/bash/manual/bash.html#Appending-Redirected-Output) 11 except it doesn't support adding alternative file descriptor numbers. Instead 12 you will need to use named pipes to achieve the same effect in Murex. 13 14 15 16 ## Examples 17 18 ``` 19 » out "Hello" >> example.txt 20 » out "World!" >> example.txt 21 » open example.txt 22 Hello 23 World! 24 ``` 25 26 ## Detail 27 28 This is just syntactic sugar for `-> >>`. Thus when the parser reads code like 29 the following: 30 31 ``` 32 echo "foobar" >> example.txt 33 ``` 34 35 it will compile an abstract syntax tree which would reflect the following code 36 instead: 37 38 ``` 39 echo "foobar" | >> example.txt 40 ``` 41 42 ### Truncating a file 43 44 To truncate a file (ie overwrite its contents) use `|>` instead. 45 46 ## See Also 47 48 * [Pipeline](../user-guide/pipeline.md): 49 Overview of what a "pipeline" is 50 * [`->` Arrow Pipe](../parser/pipe-arrow.md): 51 Pipes STDOUT from the left hand command to STDIN of the right hand command 52 * [`<read-named-pipe>`](../parser/namedpipe.md): 53 Reads from a Murex named pipe 54 * [`>>` Append File](../parser/greater-than-greater-than.md): 55 Writes STDIN to disk - appending contents if file already exists 56 * [`?` STDERR Pipe](../parser/pipe-err.md): 57 Pipes STDERR from the left hand command to STDIN of the right hand command (DEPRECATED) 58 * [`ja` (mkarray)](../commands/ja.md): 59 A sophisticated yet simply way to build a JSON array 60 * [`|>` Truncate File](../parser/greater-than.md): 61 Writes STDIN to disk - overwriting contents if file already exists 62 * [`|` POSIX Pipe](../parser/pipe-posix.md): 63 Pipes STDOUT from the left hand command to STDIN of the right hand command 64 65 <hr/> 66 67 This document was generated from [gen/parser/pipes_doc.yaml](https://github.com/lmorg/murex/blob/master/gen/parser/pipes_doc.yaml).