Skip to content

Commit

Permalink
Merge pull request #704 from orefalo/develop
Browse files Browse the repository at this point in the history
Rosetta Stone updates
  • Loading branch information
lmorg authored Aug 30, 2023
2 parents edf63c7 + 69e6b51 commit 940facd
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions gen/user-guide/rosetta-stone.inc.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,22 @@ if you want to learn more about shell scripting in Murex.
- [Objects](#objects)
- [Sub-shells](#sub-shells)
- [Footnotes](#footnotes)
- [Others](#others)

</div>

{{ end }}
### Output & error streams
| Description | Bash | Murex |
|---------------|---------------|--------|
| [Write to STDOUT](../commands/out.md) | `echo "Hello Bash"` | `out "Hello Murex"` <br/><br/>`echo "Hello Murex"` [[1]](#footnotes)
| [Write to STDOUT](../commands/out.md) | `echo "Hello Bash"` | `out "Hello Murex"` <br/><br/>`echo "Hello Murex"` [[1]](#footnotes)|
| [Write to STDERR](commands/err.md) | `echo "Hello Bash" >2` | `err "Hello Murex"` |
| Write to file (truncate) | `echo "Hello Bash" > hello.txt` | `echo "Hello Murex" \|> hello.txt`
| Write to file (append) | `echo "Hello Bash" >> hello.txt` | `echo "Hello Murex" >> hello.txt`
| Write to file (truncate) | `echo "Hello Bash" > hello.txt` | `echo "Hello Murex" \|> hello.txt`|
| Write to file (append) | `echo "Hello Bash" >> hello.txt` | `echo "Hello Murex" >> hello.txt`|
| [Pipe commands](../parser/pipe-arrow.md) | `echo "Hello Bash \| grep Bash` | `echo "Hello Murex \| grep Murex` <br/><br/> `out "Hello Murex" -> regexp m/Murex/` |
| [Redirect errors to STDOUT](../parser/pipe-err.md) | `curl murex.rocks 2>&1 \| less` | `curl murex.rocks ? less` <br/><br/> `curl <!out> murex.rocks \| less` |
| Redirect output to STDERR | `uname -a >&2` | `uname <err> -a` |
| Output [ANSI colors and styles](../user-guide/ansi_doc.md) | `echo -e "\n\032[0m\033[1mComplete!\033[0m\n"` | `out "{GREEN}{BOLD}Complete!{RESET}"` |

### Quoting strings
| Description | Bash | Murex |
Expand Down Expand Up @@ -113,6 +115,15 @@ if you want to learn more about shell scripting in Murex.
| Sub-shell, string | `"$(commands)"` <br/><br/> eg `"echo $(echo "Hello world")"` | `${commands}` [[5]](#footnotes) <br/><br/> eg `out ${out Hello world}` |
| Sub-shell, arrays | `$(commands)` <br/><br/> eg `$(echo 1 2 3)` | `@{commands}` [[5]](#footnotes) <br/><br/> eg `out @{ %[1,2,3] }` |

### Others
| Description | Bash | Murex |
|---------------|---------------|--------|
|Add PATH entries|export PATH=/usr/local/bin:$HOME/bin:$PATH|$PATH -> :paths: prepend /usr/local/bin $HOME/bin -> export PATH|
|Iterate files|for i in $(find . -maxdepth 1 -mindepth 1 -type d); do<br/>echo $i<br/>done|g * -> f +d -> foreach i {<br/>out $i<br/>}|




### Footnotes

1. Supported for compatibility with traditional shells like Bash.
Expand Down

0 comments on commit 940facd

Please sign in to comment.