mirror of
https://github.com/foo-dogsquared/wiki.git
synced 2025-01-31 07:57:57 +00:00
f45135c418
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
1.5 KiB
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.