bshchk

home | manual | repo

bshchk - a dependency checker for bash scripts

table of contents


these instructions are suited for UNIX systems.
if you are on windows, idk good luck i guess

getting started

installation

there are a few ways:

  1. manually, from a git repo

    first, clone the damn thing: git clone https://git.blek.codes/blek/bshchk.git

    then cd to that directory and compile it with build.sh. copy the binary to one of your $PATH directories

  2. from a package manager

    bshchk is not currently available on any package manager

usage

bshchk supports the following comment tags:

# to add one or a bunch of CMDs to dependencies
#bshchk:add-cmd cmd1 cmd2
#bshchk:add-cmd cmd

# to exclude one or a bunch of CMDs from dependencies
#bshchk:ignore-cmd cmd1 cmd2
#bshchk:ignore-cmd cmd

also, bshchk requires for the script to have #!/bin/bash or #!/usr/bin/env bash as the first line.

if you really need, there is a CLI Option --ignore-shebang to ignore an invalid shebang, although it is not recommended.

CLI options

--yield-deps-only

will print the dependencies as a JSON array, like this: ["one", "two", "three"]. would be useful when you want to handle the dependencies yourself

--expose-deps

add this flag to add deps variable to your script with an array of dependencies

--deps-var-name

change the deps variable name to your liking

--ignore-shebang

(not recommended) if you want to use any other shebang than #!/bin/bash or #!/usr/bin/env bash