Skip to content

brianjfox/brash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

brash

A modern C++ reimplementation of a POSIX-compatible interactive shell inspired by GNU Bash. It aims for high fidelity behavior with pipelines, redirections, expansions, job control, readline/history, aliases, functions, and builtins.

Features

  • Pipelines, redirections (>, >>, <, n>&m, here-strings, here-docs)
  • Expansions: tilde, parameter (${VAR}, ${VAR}), command substitution $(...), arithmetic $((...)), globbing, IFS word splitting, brace expansion
  • Builtins: cd, echo, pwd, export, unset, set, shift, alias/unalias, test/[ , source (.), true/false, wait, jobs, fg, bg
  • Readline prompts with PS1/PS2 escapes; history persistence
  • Job control: pipelines in process groups, foreground/background, notifications
  • Functions: multi-line definitions name() { ... } and function name() { ... }

Requirements

  • CMake ≥ 3.16
  • A C++20 compiler (AppleClang/Clang/GCC)
  • GNU Readline and (n)curses libraries (Homebrew: brew install readline)

Build

cd /Users/bfox/CLIENTS/BJF/brash
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j

This produces the executable: build/brash.

Run

Interactive:

./build/brash

Execute a command stream (non-interactive):

echo 'echo hello' | ./build/brash

Notes

  • On macOS with Homebrew readline, you may need:
    export LDFLAGS="-L/opt/homebrew/opt/readline/lib" \
           CPPFLAGS="-I/opt/homebrew/opt/readline/include"
    before configuring.
  • Echo behavior: echo implements -n/-e/-E and backslash escapes as in Bash.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors