AI Assistant Updates with Enhanced Script Safety and Expanded Compatibility
The Release of Brush Shell 0.4.0
Brush Shell, a Rust-based alternative to traditional Unix shells, continues to gain traction among users seeking bash compatibility along with built-in features such as syntax highlighting and history-based suggestions.
- A new version, 0.4.0, has been released, representing a significant milestone in the development process.
- This release incorporates more than 200 merged pull requests that span several months.
Improved Bash Compatibility
Brush Shell now supports the “set -e” feature, which terminates the shell if any command in a pipeline fails.
- It implements “pipefail,” allowing users to specify exemptions similar to those in bash.
- The “set -u” option now generates an error when referencing an unset variable, including cases involving ${#arr[i]}.
- Brush introduces the “failglob” option, treating no-match globs as errors.
- It also implements the “ERR trap,” alongside its earlier “EXIT trap” work.
- The “coproc” feature, covering both parsing and execution, provides additional functionality.
- The “–noglob / -f” command-line flag has been added, and unknown command-line options now exit with code 2 to match bash’s behavior.
Enhanced Arithmetic Handling
Arithmetic handling in Brush 0.4.0 has seen significant improvements.
- The shell now correctly handles high-radix literals, overflow and underflow behavior, legacy $[expr] syntax, the |= and ^= assignment operators, and nested array indices.
- It also includes infinite-recursion detection and improved heredoc reliability within command substitutions and quoted contexts.
Additional Features and Fixes
Built-ins, including “caller,” “read,” “mapfile -O,” “getopts,” “compgen -A,” and “printf %q,” have received fixes or enhancements.
- Scripts that ran cleanly under version 0.3.0 may now produce errors that bash would also have generated, but this is considered intended behavior.
Platform Reach Widens
Using Brush as a login shell on macOS is now possible following a fix for a startup hang in that scenario.
- Windows path handling has been overhauled, and /dev/null emulation has been added.
- The Windows test suite is now exercised in continuous integration (CI).
- Brush builds successfully on FreeBSD, Android, and 32-bit targets, and wasm32-wasi2 smoke tests run in CI.
Interactive Features and Configuration Options
An optional TOML configuration file at ~/.config/brush/config.toml allows users to configure Brush-specific settings outside of shell scripts.
- Zsh-style preexec and precmd hooks are available behind an experimental flag, enabling users to implement prompt frameworks and timing tools.
- Semantic prompt and command marking can be enabled similarly.
- Readline macro support has been added, allowing users to improve compatibility with other tools, such as starship, atuin, and fzf.
API Changes for Embedders
The Shell type is now generic over a ShellExtensions parameter, providing a hook for embedders to add custom builtins and variable behavior without forking.
- Shell fields are private, and serde features are available on both brush-parser and brush-core for AST and shell-state serialization.
- Scaffolding for a future winnow-based parser has been added, with the existing PEG parser remaining the production code path.
Minimum Supported Rust Version Increases
The minimum supported Rust version has increased to 1.88.
- An opt-in build flag bundles coreutils builtins into a single binary, useful for containers, embedded scenarios, and Windows.
Availability and Distribution
Brush is distributed under the MIT license through various channels, including crates.io, Homebrew, Arch Linux’s extra repository, and Nix.
- Brush 0.4.0 is available for free on GitHub.
