1.1 Loading the library

The easiest way to use the core library is to include at run–time the library file libmbfl-core.bash in the script. To do it, we install the package on the system and use this code in the scripts:

source "${MBFL_LIBMBFL:=$(mbflpp.bash --print-libmbfl)}" || exit 100

after the service variables have been declared; Required user defined variables. The exit code ‘100’ is reserved for errors while loading libraries; Exit codes and return codes.

This code will read the full pathname of the library from the environment variable MBFL_LIBMBFL; if this variable is not set: the script mbflpp.bash is executed to acquire the pathname. mbflpp.bash is installed by the package in the $bindir directory, which we must include in the PATH environment variable.

The reliable way to load the library is to use the preprocessor macros mbfl_embed_library() or mbfl_load_library(), Libraries loading and embedding. Either the library is embedded in the script or it is sourced from a hard–coded file system pathname; this reduces the chances of a script being tricked into loading a file different from the actual library.

To use the preprocessor macros we must process a script’s source file with the preprocessor script mbflpp.bash, possibly using an appropriate Makefile; Using the script preprocessor.


This document describes version 3.0.0-devel.9 of Marcos Bash Functions Library.