Description #
Oil Shell is a modern Unix shell designed to replace Bash with a safer, faster, and more expressive scripting experience. It features a new language called Oil, built on top of a compatible subset of the traditional POSIX shell syntax.
History #
Oil Shell was started by Andy Chu around 2016 as an ambitious effort to fix long-standing issues in traditional Unix shells like Bash. It aims to combine the familiarity of shell scripting with modern programming practices. The project includes an interpreter that runs existing shell scripts and gradually upgrades them into Oil syntax. It’s written in Python and C++, with a focus on correctness, performance, and maintainability.
Hello World Code #
echo 'Hello, World!'
Oil-specific syntax:
print('Hello, World!')
How to Run #
Download or build Oil Shell from source:
https://www.oilshell.org/download.html
Run the interpreter:
./bin/oil
- Use
.sh
or.oil
files to run scripts.
You can also test the shell in a container or WSL environment.
Key Concepts #
- Modern replacement for Bash
- Compatible with POSIX shell
- New Oil language syntax
- Static parsing
- Safer string handling
- Improved error messages
- Designed for script portability
- Faster execution than Bash in many cases
- No silent errors
- Gradual upgrade path for Bash users
Try It Online #
- Oil Shell Playground
- Or run in a local container via Docker or WSL
Fun Facts #
- Oil Shell separates parsing and evaluation for safer scripts.
- You can write hybrid scripts using both Bash and Oil syntax.
- The project is known for its highly detailed changelogs and documentation.