Skip to content
abidanBritoPublic

About

Minimal, POSIX-like shell implementation.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

ash

C++23 CMake 3.25+ License: MIT

A small POSIX-like shell written in C++23.

Note

Only Unix-like systems are supported for now.

Features

  • Builtins: echo, type, pwd, cd, history, exit.
  • Running external programs found on PATH.
  • Pipelines.
  • Output redirection.
  • Single/double quoting and backslash escapes.
  • Line editing, history and tab completion.
  • Persistent history.

Requirements

  • GCC 11+ or Clang 17+.
  • CMake 3.25+.
  • Ninja (optional, only needed if you build with the CMake presets).
  • GNU Readline and its headers.
  • pkg-config.

Build & run

With presets

cmake --preset clang-release
cmake --build --preset clang-release

./build/clang-release/ash

Presets are named <compiler>-<variant>, with clang or gcc as the compiler:

Variant Description
debug Debug build
release Release build
asan Debug build with ASan and UBSan

Tip

cmake --list-presets and cmake --build --list-presets show all available CMake presets.

Without presets

Use any generator that CMake supports:

cmake -B build
cmake --build build

./build/ash

Roadmap

Not yet implemented:

  • Track exit statuses.
  • Signal handling.
  • Multi-line input.
  • Input redirection and 2>&1.
  • Variables: assignment & expansion.
  • Tilde expansion and globbing.
  • Command substitution.
  • Command lists (;, &&, ||).
  • Environment (export, unset).
  • Aliases (alias, unalias).
  • Background jobs and job control (&, jobs, fg, bg).
  • Compound commands (if, while, for).
  • Scripts, -c and comments.

License

This repository is released under the MIT license. See MIT for details.

About

Minimal, POSIX-like shell implementation.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages