shrub-core 0.0.4

Reusable core of a POSIX/bash shell (used by shrub-shell)
Documentation

shrub

shrub is a Bash-compatible shell written in Rust, built as a set of crates that other programs embed.

shrub is a hard fork of brush by reuben olinsky, taken from its main branch at 0ecc9c5a on 2026-10-14. It keeps brush's MIT licence and copyright notice.

Embed it

Create a shell, run Bash-compatible code in it, and inspect the result:

let mut shell = shrub_core::Shell::builder().build().await?;

let result = shell
    .run_string(
        r#"greet() { echo "Hello, $1!"; }; greet world"#,
        &shrub_core::SourceInfo::default(),
        &shell.default_exec_params(),
    )
    .await?;

assert!(result.is_success());

The examples guide covers custom builtins, calling shell functions from Rust, and serializing a syntax tree.

Crates

Crate What it provides
shrub-core The shell runtime: expansion, execution, jobs, completion, and the Shell API
shrub-parser Tokenizer and parser for Bash and POSIX shell syntax, with an optional serde syntax tree
shrub-builtins The standard builtins
shrub-interactive Line editing, highlighting, suggestions and completion, built on reedline
shrub-shell The command line of the shrub binary
shrub The shrub binary: cargo install --locked shrub
shrub-coreutils-builtins, shrub-experimental-builtins Optional builtin sets

Every crate releases at the same version.

Tests

More than 2,500 compatibility cases run each script under shrub and Bash and compare stdout, stderr, exit status and file side effects. docs/how-to/run-tests.md describes how to run them.

Known gaps: select, wait -n, disown, some traps, and the edge cases listed in the compatibility reference.

Licence

MIT; see LICENSE.