BashMatic 3.4.1 — BASH-based DSL helpers

A powerful BASH framework with 900+ helper functions to make your BASH scripting easier, more enjoyable, awesome looking, and most importantly, fun.

Terminal
source ~/.bashmatic/init
bashmatic.sh © 2015-2025 Konstantin Gredeskoul (MIT License) v3.4.1
h1 "Hello World! Welcome to Bashmatic!"
┌─────────────────────────────────────────────────────────────────────────────┐
│  Hello World! Welcome to Bashmatic!                                         │
└─────────────────────────────────────────────────────────────────────────────┘
info "Bashmatic makes your scripts look awesome"
Bashmatic makes your scripts look awesome
run "echo 'Ready to get started?'"
✔︎ echo 'Ready to get started?' 〔 60 ms 〕 0

Why Choose Bashmatic?


Kitchen Sink of 900+ Helper Functions

Extensive collection of BASH functions to handle everything from UI feedback to file operations, package management, and more.


Ruby-inspired DSL-like Syntax

Compact and self-documenting code with a Ruby-inspired DSL style. Chain functions with && and || for clean, readable scripts.


Constant Visual Feedback


Constant user feedback with colored output, progress bars, headers, and more, ensuring you always know what's happening.


Always Showing What's Running

The 'run' function shows the command, its exit status, and the timing in milliseconds. You control if its output is shown and what happens if it fails.

Widgets: Headers, Error Boxes, and more

Create visually appealing scripts with boxes, lines, headers, and progress bars that make your BASH scripts look professional.

Performance Optimized, under 200ms load

Despite offering 900+ functions, Bashmatic loads quickly (only ~134ms) and is optimized for efficiency.

Watch the 3-Minute Screencast

Don't take our word for it...

Bashmatic in Action

DSL-like Function Example:


# An example of a DSL-like function 
function bashmatic.auto-update() {
  local dir="${1:-"${BASHMATIC_HOME}"}"
  is.a-directory "${dir}" && {
    file.exists-and-newer-than "${dir}/.last-update" 30 && return 0
    ( 
      cd ${BASHMATIC_HOME} && \
      git.is-it-time-to-update && \
      git.sync-remote 
    )
  }
}

# check if the function is defined and, if so, call it.
is.a-function.invoke bashmatic.auto-update "$@"
            
          

Writing a BASH Script that Depends on Bashmatic:


#/usr/bin/env bash            
# vim: ft=bash

# Decide where you'd like Bashmatic installed. The default is ~/.bashmatic
[[ -z ${BASHMATIC_HOME} ]] && export BASHMATIC_HOME="${HOME}/.bashmatic"
[[ -d ${BASHMATIC_HOME} ]] || {
  bash -c "$(curl -fsSL https://bashmatic.re1.re)
  bashmatic-install -q"
}

source "${BASHMATIC_HOME}/init"
# This constraints the width of all widgets to 100 characters wide.
# Using it is optional, of course.
output.constrain-screen-width 100

# Install Brew packages with caching, that skips already installed 
brew.package.install rigrep rustc ruby

# install gems, with caching that skips already installed gems
gem.install git-smart standardrb

success "All done, thank you!"
            
          

Installation

1

Quick Install

The easiest way to install Bashmatic is with curl:


curl -fsSL https://bashmatic.re1.re >/tmp/installer
chmod 755 /tmp/installer
/tmp/installer -q
            
            
2

Verify Installation

After installation, you can load it like so:

source ~/.bashmatic/init
# Now we can test if a function "h1" works!
h1 "Welcome to Bashmatic, v${BASHMATIC_VERSION}"
┌─────────────────────────────────────────────────────────────────────┐
   Welcome to Bashmatic, v3.4.1                                         
└─────────────────────────────────────────────────────────────────────┘
# Now let's see if the buil-in function "os.info" works...
os.info
┌──────────────────────────────────────────────────────────────┐
        System Hardware Detected                              
├──────────────────────────────────────────────────────────────┤
        os              =                    darwin              
        arch            =                     arm64              
        cpu_vendor      =                     apple              
        cpu_count       =                        14              
        cpu_model       =                    m3.max              
        threads_per_cor =                         1              
        emulation       =                    native              
        bash_version    =                         5              
        bash_path       =    /opt/homebrew/bin/bash              
        ram_physical    =                    36.0GB              
        ram_free        =                   738.0MB              
        ram_used        =                    34.0GB              
        load_average    =            6.42 3.54 2.81              
└──────────────────────────────────────────────────────────────┘
            
            
3

Auto-loading (Optional)

To load Bashmatic when you open the terminal, add to your ~/.bash_profile:

            [[ -f ~/.bashmatic/init ]] && source ~/.bashmatic/init
            

This adds only about 134ms to your shell startup time.

Documentation

Join the Community

Bashmatic is an open-source project maintained by dedicated contributors. Get involved by joining our community channels, reporting issues, or contributing to the codebase.

Support the Project

If you find Bashmatic useful, consider supporting its development with a donation.

Donate via Liberapay