oil(1)
The Oil shell is a modern Unix shell that improves upon bash with better syntax, error handling, and performance.
Synopsis
oil [OPTIONS] [FILE] [ARGS]Description
Oil is a shell language that aims to be a drop-in replacement for bash while fixing long-standing issues with shell syntax and semantics. It supports both bash-compatible code and a cleaner Oil syntax within the same interpreter.
Oil provides stricter error handling, better string interpolation, and more predictable behavior compared to traditional shells. It can run existing bash scripts while allowing you to gradually adopt Oil's improved syntax.
The Oil shell is still under development but is suitable for interactive use and scripting. Use oil as a login shell or invoke it with scripts like oil script.oil.
Common options
| Flag | What it does |
|---|---|
-c | Execute the given command string and exit |
-n | Parse the script without executing it (syntax check) |
-x | Print each command before executing (debug mode) |
--version | Display the Oil shell version number |
--help | Show usage information and exit |
-i | Run in interactive mode even if input is not a terminal |
-l | Act as a login shell |
--ast-format | Specify AST output format (text or json) for debugging |
Examples
Start an interactive Oil shell session
oilExecute an Oil script file
oil script.oilRun a single Oil command and exit
oil -c 'echo hello world'Check script syntax without executing it
oil -n script.oilRun command with debug output showing each command executed
oil -x -c 'x=5; echo $x'Run bash script through Oil shell (compatible mode)
bash_script.sh | oil