A powerful BASH framework with 900+ helper functions to make your BASH scripting easier, more enjoyable, awesome looking, and most importantly, fun.
┌─────────────────────────────────────────────────────────────────────────────┐ │ Hello World! Welcome to Bashmatic! │ └─────────────────────────────────────────────────────────────────────────────┘
Extensive collection of BASH functions to handle everything from UI feedback to file operations, package management, and more.
Compact and self-documenting code with a Ruby-inspired DSL style. Chain functions with && and || for clean, readable scripts.
Constant user feedback with colored output, progress bars, headers, and more, ensuring you always know what's happening.
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.
Create visually appealing scripts with boxes, lines, headers, and progress bars that make your BASH scripts look professional.
Despite offering 900+ functions, Bashmatic loads quickly (only ~134ms) and is optimized for efficiency.
# 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 "$@"
#/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!"
The easiest way to install Bashmatic is with curl:
curl -fsSL https://bashmatic.re1.re >/tmp/installer
chmod 755 /tmp/installer
/tmp/installer -q
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
│
└──────────────────────────────────────────────────────────────┘
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.
Comprehensive documentation with all functions and modules explained in detail.
View HTML DocsComprehensive documentation with all functions and modules explained in detail.
View the PDF DocumentComplete index of all 900+ functions available in Bashmatic with usage examples.
View Function IndexLearn how to use Bashmatic effectively with examples and best practices.
View Usage GuideBashmatic is an open-source project maintained by dedicated contributors. Get involved by joining our community channels, reporting issues, or contributing to the codebase.
If you find Bashmatic useful, consider supporting its development with a donation.
Donate via Liberapay