Next: overview direct, Previous: overview quick, Up: overview [Contents][Index]
A more reliable way to load the library is:
declare mbfl_INTERACTIVE=no declare mbfl_LOADED=no declare mbfl_HARDCODED= declare mbfl_INSTALLED=$(type -p mbfl-config &>/dev/null && mbfl-config) &>/dev/null declare item for item in "$MBFL_LIBRARY" "$mbfl_HARDCODED" "$mbfl_INSTALLED" do if test -n "$item" -a -f "$item" -a -r "$item" then if source "$item" &>/dev/null then declare -r mbfl_LOADED_LIBRARY=$item break else printf '%s error: loading MBFL file "%s"\n' "$script_PROGNAME" "$item" >&2 exit 100 fi fi done unset -v item if test "$mbfl_LOADED" != yes then printf '%s error: incorrect evaluation of MBFL\n' "$script_PROGNAME" >&2 exit 100 fi
where the value of mbfl_HARDCODED
can be the pathname of a known location in which to find
the library. This code:
MBFL_LIBRARY
variable, to allow us to explicitly select the file
from the command line; example:
$ MBFL_LIBRARY=/path/to/libmbfl.sh script.sh
mbfl-config
script to pick up a library installed
on the system.
We see that the output of the source
command is discarded: this is because we assume that:
This code is included in the MBFL distribution in the src/lib/loader.sh file; we can also
automatically include it in a script with the preprocessor macro mbfl_library_loader
.
Next: overview direct, Previous: overview quick, Up: overview [Contents][Index]