Skip to main content

Introduction

Bashing is a small Bash helper library for scripts that need better ergonomics without dragging in a larger framework.

What It Includes

  • Bootstrap helpers for resolving project and task paths.
  • Logging and terminal UI helpers for readable command output.
  • Dotenv parsing utilities for local environment files.
  • Docker Compose helpers for safe project-aware detection.
  • Opt-in privilege helpers that respect CAN_SUDO.

Install

Install Bashing into the current project's scripts folder:

cd myproject/scripts
curl -fsSL https://raw.githubusercontent.com/xavier-sanna/bashing/main/install.sh | bash

To install from a different directory, pass the target path to Bash:

curl -fsSL https://raw.githubusercontent.com/xavier-sanna/bashing/main/install.sh | bash -s -- /path/to/my-project/scripts

Basic Usage

#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'

# bootstrap.sh will load the library and determine the root of your project
source "$(dirname "${BASH_SOURCE[0]}")/bashing/bootstrap.sh"

dotenv_load "$PROJECT_ROOT/.env"
PROJECT_NAME="${PROJECT_NAME:-${PROJECT_ROOT##*/}}"

title "My awesome script" "$PROJECT_NAME"
with_status "Performing awesome scripting stuff" pnpm run stuff

Next Steps

  • Browse the docs sections for available helpers and usage patterns.
  • Check the repository examples/ directory for complete scripts.
  • Run ./demo.sh from the repo root to see the modules in action locally.