-c operand ordering; fix test socket paths
`bash -c` does not bind to the token that follows it: short-option parsing
continues and the command string is the first operand, so `bash -c -l <cmd>`
runs `<cmd>` as a login shell. brush's clap CLI instead binds `-c` to the next
token and rejects one shaped like an option, so every command the agent CLI
sent as `-c -l <cmd>` inside naros-agent failed with
error: a value is required for '-c <COMMAND>' but none was supplied
Since narOS diverts /bin/sh, /bin/bash and /bin/dash to nash, that broke every
command in the container. nash's compat fallback did not cover it either: it
read "-l" as the command, which parses fine as bash, so no fallback fired.
Normalize the argv before clap sees it, hoisting short options that sit between
the `-c` group and its command ahead of that group (`-c -l cmd` -> `-l -c cmd`),
including value-taking ones (`-c -o xtrace cmd`, `-c -oxtrace cmd`). Only short
options are hoisted — bash itself rejects long options once short-option parsing
has begun — and anything not positively identified as an option ends the scan,
so a command string is never mistaken for a flag. Teach nash's dash_c_command()
the same rule so the parse-failure fallback checks the real command.
Also repair the observe test harness, which could not run under a normal macOS
TMPDIR: it named its socket directory with `{:?}` of an Instant (~45 chars),
overflowing sun_path, and never cleaned up, so a recycled pid inherited a stale
socket and failed the bind with AlreadyExists. Route every scratch directory
through a helper that keeps names short, falls back to /tmp when the socket path
would not fit, clears stale state, and drops the directory when the sink dies.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
brush (Bo(u)rn(e) RUsty SHell) is a modern bash- and POSIX- compatible shell written in Rust. Run your existing scripts and .bashrc unchanged -- with syntax highlighting and auto-suggestions built in.
At a glance
✅ Your existing .bashrc just works—aliases, functions, completions, all of it.
✨ Syntax highlighting and auto-suggestions built in.
🧪 Validated against bash with ~1700 compatibility tests.
🧩 Easily embeddable in your Rust apps using brush_core::Shell.
⚠️ Not everything works yet:
selectand some edge cases aren't supported. See the Compatibility Reference for details.
Quick start:
$ cargo binstall brush-shell # using cargo-binstall
$ brew install brush # using Homebrew
$ pacman -S brush # Arch Linux
$ cargo install --locked brush-shell # Build from sources
brush is ready for use as a daily driver. We test every change against bash to keep it that way.
More detailed installation instructions are available below.
✨ Features
🐚 bash Compatibility
| Feature | Description | |
|---|---|---|
| ✅ | 50+ builtins | echo, declare, read, complete, trap, ulimit, ... |
| ✅ | Full expansions | brace, parameter, arithmetic, command/process substitution, globs, extglob, globstar |
| ✅ | Control flow | if/for/while/until/case, &&/||, subshells, pipelines, etc. |
| ✅ | Redirection | here docs, here strings, fd duplication, process substitution redirects |
| ✅ | Arrays & variables | indexed/associative arrays, dynamic variables, standard well-known variables, etc. |
| ✅ | Programmable completion | Works with bash-completion out of the box |
| ✅ | Job control | background jobs, suspend/resume, fg/bg/jobs |
| 🔷 | Traps & options | DEBUG/ERR/EXIT traps work; signal traps and options in progress |
⌨️ User Experience
| Feature | Description | |
|---|---|---|
| ✅ | Syntax highlighting | Real-time as you type (reedline) |
| ✅ | Auto-suggestions | History-based hints as you type (reedline) |
| ✅ | Rich prompts | PS1/PROMPT_COMMAND, right prompts, starship compatible |
| ✅ | TOML config | ~/.config/brush/config.toml for persistent settings |
| 🧪 | Extras | fzf/atuin support, zsh-style precmd/preexec hooks (experimental), VS Code terminal integration |
Installation
When you run brush, it should look exactly as bash does on your system: it processes your .bashrc and
other standard configuration. If you'd like to distinguish the look of brush from the other shells
on your system, you may author a ~/.brushrc file.
🍺 Installing using Homebrew (macOS/Linux)
Homebrew users can install using the brush formula:
brew install brush
🐧 Installing on Arch Linux
Arch Linux users can install brush from the official extra repository:
pacman -S brush
🚀 Installing prebuilt binaries via `cargo binstall`
You may use cargo binstall to install pre-built brush binaries. Once you've installed cargo-binstall you can run:
cargo binstall brush-shell
🚀 Installing prebuilt binaries from GitHub
We publish prebuilt binaries of brush for Linux (x86_64, aarch64) and macOS (aarch64) to GitHub for official releases. You can manually download and extract the brush binary from one of the archives published there, or otherwise use the GitHub CLI to download it, e.g.:
gh release download --repo reubeno/brush --pattern "brush-x86_64-unknown-linux-gnu.*"
After downloading the archive for your platform, you may verify its authenticity using the GitHub CLI, e.g.:
gh attestation verify brush-x86_64-unknown-linux-gnu.tar.gz --repo reubeno/brush
🐧 Installing using Nix
If you are a Nix user, you can use the registered version:
nix run 'github:NixOS/nixpkgs/nixpkgs-unstable#brush' -- --version
🔨 Building from sources
To build from sources, first install a working (and recent) rust toolchain; we recommend installing it via rustup. Then run:
cargo install --locked brush-shell
Community & Contributing
This project started out of curiosity and a desire to learn—we're keeping that attitude. If something doesn't work the way you'd expect, let us know!
- Discord server — chat with the community
- Building from source — development workflow
- Contribution guidelines — how to submit changes
- Technical docs — architecture and reference
Related Projects
Other POSIX-ish shells implemented in non-C/C++ languages:
nushell— modern Rust shell (providesreedline)fish— user-friendly shell (Rust port in 4.0)Oils— bash-compatible with new Oil languagemvdan/sh— Go implementationrusty_bash— another Rust bash-like shell
🙏 Credits
This project relies on many excellent OSS crates:
reedline— readline-like input and interactive featuresclap— command-line parsingfancy-regex— regex supporttokio— async runtimenix— Unix/POSIX APIscriterion.rs— benchmarkingbash-completion— completion test suite
Licensed under the MIT license.