Why Use Oil?


blog | oilshell.org

Why Insist Oil?


(Final updated 2020-08-07)

Oil is a fresh Unix shell. Or no longer it’s our toughen route from bash to a larger
language and runtime.

There are pretty a few facets of the Oil challenge, with pretty a few levels of maturity. The
POSIX and bash aspects are basically the most outdated.

This page represent the advantages of Oil concisely, linking to runt print. It
will most likely be updated constantly. Let me know if it will get outdated-normal!

What You Can Insist Ultimate Now

Oil runs your fresh POSIX shell scripts and bash scripts. It would not
fragment your codebase or pool of contributors. Wiki: Shell Functions That Accelerate

If you’re no longer willing to swap correct away, you may perhaps expend it concurrently with
bash. Oil is a factual a dev draw for shell scripts, like

  • It will probably in point of fact receive bugs to your shell scripts.
    • It parses more strictly. For instance, it came upon bugs in ble.sh by
      statically parsing it.
    • It has a dozen or so strict modes at runtime, e.g. as described under
      the #staunch-issues designate. (TODO: more doctors / blog posts about
      strict modes).
  • It has larger and more trusty error messages than any pretty a few POSIX shell.
    It aspects you to line number and column that prompted the error.
  • It helps you steer obvious of unsafe constructs (safety).
    • eval_unsafe_arith is off by default. Static parsing is preferable to
      dynamic parsing. The latter outcomes in records done as code.

More advantages:

  • It saves you from quoting hell. No more !qefs (quote every fucking
    substitution). Private about Straightforward Discover

    • Splicing syntax is @myarray, no longer the awkward "${myarray[@]}" (blog
      put up
  • Files Structures
    • Oil has arrays and associative arrays that repair the surprises and bugs in
      bash. (Private about What’s Nasty With Arrays in bash, requires
      Zulip login)
  • Ruby-like Blocks are a fresh shell language invent which originate up many

    • cd /tmp { echo $PWD } works!
  • Efficiency
    • Parsing tempo.
    • Runtime “compute” tempo.
    • I/O tempo. Oil Starts Fewer Processes Than Diversified Shells (TODO: blog put up)
  • It prints strings consistently with a structure known as QSN.
  • Conveniences like a builtin readlink.

In case you may perhaps write Python, you may perhaps alternate Oil! Private in regards to the part below.

By The Stop of 2020

  • Fix issues with errexit.
  • Debugging aspects
    • repr builtin. (Koichi loved this.)
    • argv or write --qsn.
    • --debug-file (TODO: test, record)
  • More Efficiency (link to runt print)
  • More Oil Blocks
    • shopt ... { ... }
  • Dev Instruments (maybe)
    • smash dump in JSON
    • Higher tracing. (Hierarchical logging?)

For Machine Integrators, e.g. Linux Distro Maintainers

Oil is standards compliant:

  • Or no longer it’s a POSIX shell, meaning it’ll even be the simplest shell on a Unix
    machine. You fabricate no longer decide to non-public up two shells.
  • It ships as identical outdated C++ 11, and is written in opposition to ANSI C APIs (e.g. GNU
    libc, musl libc). Oil has very few invent dependencies.

    • Expose that Oil’s metalanguage is statically-typed Python + DSLs,
      but you fabricate no longer desire a Python interpreter to invent or expend it.

What’s Deliberate (Benefit Wished!)

This work will happen in 2021 or later (or by no reach). I’m hoping Oil will most likely be invaluable
rapidly, and entice contributors.

  • A new expression language, with varieties.
    • We decide to receive rid of unsightly shell syntax like ${x%%prefix}, in desire of
      Python- or JavaScript-like expressions.
  • An awk-like language for filtering tables.
    • This can expend QTSV, an
      enhancement to TSV that makes expend of QSN strings.
  • Blocks enable “declarative” configuration and DSLs. For instance, the
    capability to generate Ninja recordsdata. A replace for the
    shell-in-YAML antipattern.

    • A better flag parser for shell.
  • A sandboxed interpreter for configuration, and for writing a shell UI in
  • That’s, a basis for a principled interactive shell, i.e. written in
    Oil and no longer C/C++.

    • Descriptions proven in completion.
    • A zsh-like interactive interface.

Oil’s Code Is Straightforward To Alter

  • It takes 2 minutes to invent and regulate. (TODO: screencast.)
  • Statically typed with MyPy.
  • Written in high level DSLs, meaning the code is short. In
    comparability, the bash implementation is long-winded. It grovels
    through backslashes and braces one after the other.
  • No matter the high-level languages, the ensuing code is efficient, ensuing from
  • Comprehensive exact invent infrastructure.

Why Now not Insist It?

  • The documentation is sparse. Benefit wished!
  • As of August 2020, there’s restful a separation between oil-native and
    Oil in Python. I’m hoping that oil-native may be the advised
    tarball by the pause of 2020.

More Records

Salvage Oil

  • Rating the Most standard Release
  • The attach To Ship Feedback

Read More

Leave A Reply

Your email address will not be published.