Syndication Icon
Published August 20, 2014 Updated October 21, 2021
Bashsmith Icon

Bashsmith

Git Badge
Circle CI Status

Bashsmith is a project template for smithing new Bash shell-based projects based on best practices. This project is meant to be cloned and customized for your specific shell scripting needs giving you a foundation from which to get started faster than with an empty slate.

Features

  • Provides default project structure for creating new Bash projects.

  • Provides default settings for making Bash scripts easier to develop and debug.

Requirements

Setup

To install, run:

git clone https://github.com/bkuhlmann/bashsmith.git
cd bashsmith
git checkout 4.0.1

Usage

File Structure

All files located within this project provide the basic structure/blueprint for creating new Bash script projects. The structure is organized as follows:

├── CHANGES.adoc          # The details of past version releases.
├── CODE_OF_CONDUCT.adoc  # Guidelines for encouraging harassment-free contributions.
├── CONTRIBUTING.adoc     # The details of how to contribute to the project.
├── LICENSE.adoc          # The license and copyright legalities of the project.
├── README.adoc           # The project overview, setup, usage, testing, etc.
├── bin                   # A folder for executable Bash scripts.
│   └── run               # The main run script (which loads the lib and settings).
├── lib                   # A folder for Bash functions and custom code.
│   └── cli.sh            # Provides CLI prompt options for the main `run` script.
├── settings              # The global/project settings for easy manipulation/tweaking.
│   └── main.sh           # The global settings (set with safe defaults).

Template

The following documents what each template option is:

# Exit, with error message, when attempting to use an undefined variable.
set -o nounset

# Abort script at first error, when a command exits with non-zero status.
set -o errexit

# Return exit status of the last command in the pipe that returned a non-zero return value.
set -o pipefail

# Defines newlines and tabs as delimiters for splitting words and iterating arrays.
IFS=$'\n\t'

Development

To contribute, run:

git clone https://github.com/bkuhlmann/bashsmith.git
cd bashsmith

Tests

Consider using Bats.

Versioning

Read Semantic Versioning for details. Briefly, it means:

  • Major (X.y.z) - Incremented for any backwards incompatible public API changes.

  • Minor (x.Y.z) - Incremented for new, backwards compatible, public API enhancements/fixes.

  • Patch (x.y.Z) - Incremented for small, backwards compatible, bug fixes.

Code of Conduct

Read Code of Conduct for details.

Contributions

Read Contributions for details.

License

Read License for details.

History

Read Changes for details.

Credits

Engineered by Brooke Kuhlmann.