Brush v0.4.0

Brush v0.4.0

Brush is a command shell written in Rust, combining POSIX and Bash compatibility with memory safety guarantees and performance. The project aims to become a full-fledged alternative to traditional shells, allowing existing scripts to run and use .bashrc with minimal changes. This version incorporates several months of work and over 200 merged pull requests, significantly advancing the shell towards full replacement of Bash and POSIX-compatible environments.

Key development areas in this release:

  • Bash compatibility: added set -e, set -u, pipefail, failglob, ERR handler, coprocesses, and much more;
  • Reliability: improved handling of exceptional cases – closed channels, broken output, non-UTF8 history, and others;
  • Platforms: extended support for macOS (acting as a login shell), improved performance on Windows, FreeBSD, Android, and 32-bit systems;
  • Interactivity: added optional TOML configs, preexec/precmd hooks, improved support for readline macros, and more.

Key Improvements in Bash Compatibility

The most significant enhancements in this release include a substantial expansion of Bash capability support. Error Handling:

  • set -e (errexit) – immediate exit on error;
  • set -u (nounset) – error on referencing an undeclared variable;
  • pipefail – the return code of a pipeline is determined by the last failed command;
  • failglob – no matches for a glob expression now results in an error.

Handlers (Traps) and Coprocesses:

  • ERR handler – allows executing commands upon encountering an error;
  • Coprocesses (coproc) – launching background processes with bidirectional communication.

Built-in Commands:

  • enhanced handling of many arithmetic constructions, including high-base literals, overflows, and assignment operators;
  • fixes and improvements affecting built-in commands: caller, read, getopts, printf, and others.

Extension of Platform Support:

Release v0.4.0 makes the shell available on a wider range of devices:

  • macOS: fixed an issue causing the shell to hang on login. Brush can now be used as a login shell;
  • Windows: improved path handling, added emulation of /dev/null, greatly enhancing usability on Windows;
  • FreeBSD and Android: build support for these platforms;

Interactive capabilities and API

  • Configuration: added support for an optional TOML config file (~/.config/brush/config.toml) for brush-specific settings;
  • Customization: implemented zsh styles for preexec/precmd hooks (behind an experimental flag), useful for creating custom prompts and timing tools;
  • API for developers: the Shell type is now parameterized by extensions (ShellExtensions), allowing developers to add their own built-in commands and change variable behavior without forking the project;
  • Miscellaneous:
    • improved support for readline macros for compatibility with starship, atuin and fzf (github.com);
    • added serialization capabilities for AST and shell state through serde;
    • now brush-parser and brush-core have serde functions available for serializing AST and shell state.

Source: linux.org.ru

Buy reliable website hosting with DDoS protection, VPS VDS servers 🔥 Buy reliable website hosting with DDoS protection, VPS VDS servers | ProHoster