librelib(1) -- finds a Bash library file
========================================

## SYNOPSIS

`. "$(librelib LIBRARY)"`<br>
`librelib -h`

## DESCRIPTION

`librelib` is a program to find a Bash(1) library file at run-time.
This way, the path does not need to be hard-coded into the
application; think of it as a sort of dynamic-linker for shell
programs.

There are several reasons for doing this, instead of hard-coding the
path:

 * The install path can change in the future without having to change
   programs that use them.
 * The install directory can be configured at runtime, by setting
   `LIBRETOOLS_LIBRARY_PATH`, similar to `LD_PRELOAD` (this is used
   when running the test suite).
 * The naming scheme of a library can change (such as between
   `libreNAME` and `NAME.sh` without changing programs that use it.

By default, `librelib` looks in `/usr/lib/libretools`, but that can be
changed by setting the `LIBRETOOLS_LIBRARY_PATH` environmental variable to
the directory it should look in.

When searching for a library, `librelib` first strips `libre` from the
beginning of the name, and `.sh` from the end.  This means that all of
the following are equivalent:

    . "$(librelib messages)"
    . "$(librelib messages.sh)"
    . "$(librelib libremessages)"
    . "$(librelib libremessages.sh)"

Once it has the 'base' name of the library it is looking for, it looks
for a file with that 'base' name (allowing for, but not requiring
`libre` to be prepended, or `.sh` to be appended) in whichever
directory it is looking in.

If it cannot find a suitable library file, it will print an error
message to standard error, and exit with a code of 1.

## Examples

    . "$(librelib messages)"
    . "$(librelib conf)"

## SEE ALSO

librelib(7)

<!--
  Copyright (C) 2013-2014, 2024  Luke T. Shumaker <lukeshu@parabola.nu>

  SPDX-License-Identifier: GPL-2.0-or-later

  This file is part of Parabola Libretools.

  Libretools is free software: you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 2 of the License, or
  (at your option) any later version.

  Libretools is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-->
