Rust’s Brush Shell Hits 0.4 Milestone: Bash Fidelity Meets Modern Safeguards in Open-Source Command Line

Brush 0.4.0 advances Rust-based shell with full Bash error handling like set -e and pipefail, coprocess support, macOS login fixes, and TOML config. Over 200 PRs boost compatibility and platforms from Windows to WASM.
Rust’s Brush Shell Hits 0.4 Milestone: Bash Fidelity Meets Modern Safeguards in Open-Source Command Line
Written by Dave Ritchie

Brush, the Rust-forged challenger to Bash and POSIX shells, just dropped version 0.4.0. Developers call it a “significant” leap—over 200 pull requests merged across months of grinding work. Your .bashrc runs unchanged. Scripts that bombed silently before now fail as Bash demands. Edge cases? Crushed.

This isn’t some toy replacement. Brush aims straight for Bash’s throne, blending POSIX compliance with Rust’s ironclad memory safety. No more buffer overflows sneaking through like in C-based shells. Interactive perks come baked in: syntax highlighting, history-driven suggestions. And now, it’s tougher, cross-platform, ready for real workloads.

The Phoronix coverage nailed the basics: Brush v0.4 debuted today for this “Bourne Rusty Shell”, highlighting set -e, set -u, pipefail, ERR traps, coprocesses. “Closed pipes, broken stdout, unusual file-descriptor states, non-UTF8 history files, and platform corner cases are now handled gracefully,” the release notes state. A systematic audit wiped out whole failure classes.

Bash Features Locked In, No More Half-Measures

Prior versions let you write set -e. It didn’t bite. Scripts plowed on past errors. No longer. Brush 0.4 implements set -e (errexit) and pipefail with Bash’s quirky exemptions—those accumulated rules that trip up newcomers. Set -u flags unset variables, even in array length checks like ${#arr[i]}. Failglob turns unmatched globs into errors. Coproc parses and runs, opening doors to parallel tasks.

Arithmetic got a full overhaul. High-radix literals. Overflow that matches Bash. Legacy $[expr] syntax. Bitwise |= and ^= ops. Nested array indices. Infinite recursion? Detected and halted. Heredocs play nice in subshells and quotes. Builtins like caller, read, mapfile -O, getopts fill gaps. Compgen -A now handles bindings, commands, reserved words.

But here’s the kicker. These aren’t add-ons. They’re fidelity matches, validated against 1,700 Bash tests. Help Net Security breaks it down: Brush shell 0.4.0 tightens script safety, closing gaps so v0.3 scripts now exit where Bash would. Unknown options? Exit code 2, just like Bash. –noglob flag added. Patterns and extglobs handle escapes, backslashes, character sets properly.

Variables too. BASH_ARGC, BASH_ARGV populated. $_ works. OSTYPE sets on macOS. Prompts parse \l, \[, $?. Shadowing builtins with functions? Fixed.

Short. Painful for sloppy scripts. Essential for production.

Interactive Polish and Platform Reach Expand

Daily drivers want flair. Brush delivers. TOML config at ~/.config/brush/config.toml—opt-in, for prompt tweaks outside scripts. Zsh-style preexec/precmd hooks, experimental. Terminal smarts for semantic prompts. Readline macros for starship, atuin, fzf compatibility. Completions escape filenames right, offer . and .., mark directories.

Platforms? macOS login shell fixed—no more hangs. Windows paths overhauled, /dev/null emulated (experimental). FreeBSD builds clean. Android, 32-bit, wasm32-wasip2 in CI. The GitHub release tags it all: brush v0.4.0.

Project stats impress. 1.6k GitHub stars. 33 contributors. MIT license. Crates.io lists 21k downloads. Arch Linux packages it in extra repo. Homebrew, Nix too. Embed it via brush_core::Shell—generic for custom builtins, no forking needed. Serde for AST serialization. Rust 1.88 minimum.

Rust shells multiply—nushell diverges, fish ports to Rust. Brush sticks to Bash. Why? Legacy scripts everywhere. DevOps pipelines. Containers. No rewrite needed. OSH pushes compatibility too, but Brush bets on Rust’s speed and safety.

Benchmarks? Repo has a cross-shell script in /benchmarks. No public numbers yet. Rust’s zero-cost abstractions promise parity or better on loops, recursion. Syscall counts could drop. Watch that space.

Installation’s dead simple. Cargo install –locked brush-shell. Prebuilts for Linux x86_64/aarch64, macOS aarch64 on GitHub. Pacman -S brush on Arch. Verify with gh release download.

So, switch? Test your pipelines. Fire up .bashrc. If it sings, you’ve got a safer, snappier shell. Rust’s grip tightens on Unix core.

Subscribe for Updates

DevNews Newsletter

The DevNews Email Newsletter is essential for software developers, web developers, programmers, and tech decision-makers. Perfect for professionals driving innovation and building the future of tech.

By signing up for our newsletter you agree to receive content related to ientry.com / webpronews.com and our affiliate partners. For additional information refer to our terms of service.

Notice an error?

Help us improve our content by reporting any issues you find.

Get the WebProNews newsletter delivered to your inbox

Get the free daily newsletter read by decision makers

Subscribe
Advertise with Us

Ready to get started?

Get our media kit

Advertise with Us