You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
# Petri
|
|
|
|
|
|
|
|
A directional shell
|
|
|
|
|
|
|
|
# Syntax
|
|
|
|
|
|
|
|
The syntax of petri is a bit different than normal shells because it uses ASCII art to define running graphs
|
|
|
|
|
|
|
|
```
|
|
|
|
#!/usr/bin/env petri
|
|
|
|
\(diff @ @)
|
|
|
|
^ ^
|
|
|
|
| |
|
|
|
|
\(ls /dev) -> replace_x --+-> replace_y --x-+
|
|
|
|
| |
|
|
|
|
+-> replace_z --+
|
|
|
|
---
|
|
|
|
replace_x: sed 's:x:y:g'
|
|
|
|
replace_y: sed 's:y:z:g'
|
|
|
|
replace_z: sed 's:z:x:g'
|
|
|
|
```
|
|
|
|
|
|
|
|
This would be the equivalent of the bash file:
|
|
|
|
|
|
|
|
```
|
|
|
|
ls /dev | sed 's:x:y:g' > /tmp/temp_file
|
|
|
|
diff <(sed 's:z:x:g' < /tmp/temp_file) <(sed 's:y:z:g' < /tmp/temp_file)
|
|
|
|
```
|
|
|
|
|
|
|
|
#### Why 'petri'
|
|
|
|
|
|
|
|
Originally I wanted to call it `dish` but I found that too generic, and since dish is from time to time preceded with petri, I chose that.
|