wiki/structured/shell.oil.org
Gabriel Arazas f45135c418 Create the hierarchical notes
The notes are mainly extracted from the daily fleeting notes which
clutter some of the more important thoughts. I figured it would be
better to create Dendron-inspired hierarchical notes.

Also, some of the notes are updated. I also started to create my visual
aids for whatever reason. ;p
2021-05-10 08:49:29 +08:00

1.5 KiB

Oil shell

For future references:

oil --version
Oil version 0.8.7
Release Date: 2021-01-23 07:35:11+00:00
Arch: x86_64
OS: Linux
Platform: #13~1617215757~20.10~97a8d1a-Ubuntu SMP Thu Apr 1 21:09:17 UTC 2
Compiler: GCC 10.2.0
Interpreter: OVM
Interpreter version: 2.7.13
Bytecode: bytecode-opy.zip

This version contains incomplete implementation and documentation which is why I'm noting it here.

  • You can make an array so far with var x = %().
  • To push for an array, use push :ARRAY_VAR $ITEMS....
  • Oil has two main syntactic modes: command and expression mode. Command mode is more like Bash while expression mode is more like Python. This is how Oil can make a rich and expressive scripting that is closer to the shell.
  • Oil will go into expression mode in few places:

    • In RHS of an assignment expression.
    • In if statements (e.g., if ($EXPR) { echo "WHOA" }).
    • Interpolated Oil expressions with $[] (e.g., $[true], $[len(ARGV)).
  • Oil can parse different modes, making it possible to create DSLs and to deal with the complex syntax of the shell.
  • You can also create an array with []. The %() is more like for an array of objects.
  • You can enter into expression mode with _. Although, this simply ignores the expression and will not be printed. Still pretty useful.