Skip to main content

Clone the repository

First, clone the bash::framehead repository from GitHub:
git clone https://github.com/BashhScriptKid/bash-framehead.git
cd bash-framehead

Compile the framework

The framework is distributed as modular source files in src/ that need to be compiled into a single file before use:
./main.sh compile
# → compiled.sh
This creates compiled.sh in the current directory, containing all 16 modules and ~785 functions.
The compiled file is not included in the repository to prevent it from drifting out of sync with the source. Compiling it yourself ensures you have the latest version and gives you the flexibility of the modular architecture.

Custom output filename

You can specify a custom output filename:
./main.sh compile myproject-stdlib.sh
# → myproject-stdlib.sh

Compilation process

The compiler:
  1. Collects all .sh files from the src/ directory
  2. Optionally runs shellcheck on each module (if available)
  3. Strips duplicate shebangs (keeps only the first one)
  4. Concatenates all modules into a single file
  5. Makes the output executable
1

Validate source directory

The compiler checks that src/ exists and contains .sh files
2

Run static analysis

If shellcheck is installed, each module is analyzed for common issues and the results are displayed
3

Concatenate modules

All modules are combined into a single file, with shebangs removed from all but the first file
4

Make executable

The output file is marked as executable with chmod +x

Project structure

Understanding the project layout helps when working with bash::framehead:
bash-framehead/
├── main.sh               # Entry point — compile, test, stat
├── compiled.sh           # Compiled single-file output
├── gen_wiki.sh           # Wiki generator
├── src/
│   ├── runtime.sh        # Required — everything depends on this
│   ├── array.sh
│   ├── colour.sh
│   ├── device.sh
│   ├── fs.sh
│   ├── git.sh
│   ├── hardware.sh
│   ├── hash.sh
│   ├── math.sh
│   ├── net.sh
│   ├── pm.sh
│   ├── process.sh
│   ├── random.sh
│   ├── string.sh
│   ├── terminal.sh
│   └── timedate.sh
└── wiki/
    └── ...
The runtime.sh module is required and must be kept. All other modules depend on it for core functionality like runtime::has_command and OS detection.

Modular architecture

One of bash::framehead’s strengths is its modular design. You can customize which modules to include:

Remove unwanted modules

Don’t need networking? Simply remove src/net.sh before compiling:
rm src/net.sh
./main.sh compile custom.sh

Keep only what you need

For minimal builds, keep runtime.sh and only the modules you need:
# Backup original src/
cp -r src src.backup

# Keep only runtime and string modules
rm src/*.sh
cp src.backup/runtime.sh src/
cp src.backup/string.sh src/

# Compile minimal build
./main.sh compile minimal.sh
Modules have minimal coupling to each other. As long as runtime.sh is kept, the rest can be mixed and matched freely.

Verify installation

After compilation, verify that everything works:

Test the framework

Run the comprehensive test suite:
./main.sh test ./compiled.sh
Expected output:
=== bash::framehead functional smoke tests ===

--- string ---
  PASS  string::upper
  PASS  string::lower
  ...

=== Results: 659 passed, 0 failed, 8 skipped, 1 untested ===
=== Success rate: 100.0% (659/659) ===

Check framework statistics

Get detailed statistics about load time and function count:
./main.sh stat ./compiled.sh
This displays:
  • File size in lines and bytes
  • Load time in a fresh shell
  • Function count by module
  • Total functions loaded

Next steps

Quick start guide

Learn how to use bash::framehead in your scripts

Module reference

Explore all 16 modules and their functions

Build docs developers (and LLMs) love