Skip to content

📉 Usage

📜 Script

From the libbash root dir
task new-script SCRIPT=myscript
mv ./myscript.sh /to/myproject/myscript.sh

Note

Task automatically adds an sh file extension to the script filename.

myscript.sh
#!/usr/bin/env bash

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

# shellcheck source=/dev/null
source "${DIR}/libbash/init"
source "${LIBBASH_DIR}/logging"

lb_infoln "infoln test"

🏕 Environmental Variables

Environmental variables are used to set some options for the library. They can be set a few different ways.

#!/usr/bin/env bash

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

source "${DIR}/libbash/init"
source ${LIBBASH_DIR}/script
FOO=BAR
...
FOO=BAR ./myscript.sh
FOO=BAR
./myscript.sh

🧩 Examples

Example scripts exist to demonstrate how to use the libraries and functions

Note

Example scripts need to be ran inside of the examples directory.

task example EXAMPLE=logging
cd examples
./logging.sh