Introduction to SHPEC

SHPEC brings a simple yet powerful ability to testing bash scripts, or even testing other systems using a set of bash commands. Getting started you will need a few ingredients.


Bake Time

  • 5 min


Start off by creating a directory to build tests in.

mkdir shpec

Create a file called “” and fill it with the code below.

describe "test"
  it "works"
    assert equal "test" "test"

Lastly run the tests.


Now that you have a simple set of tests experiment using some of the other matchers available.

Binary Matchers
equal         # equality
unequal       # inequality
gt            # algebraic '
lt            # algebraic '
match         # regex match
no_match      # lack of regex match

Unary Matchers
present       # string presence
blank         # string absence
file_present  # file presence
file_absent   # file absence
symlink       # tests a symlink's target
test          # evaluates a test string