Shell Script Libraries

BashSupport Pro supports user-defined shell script libraries to help with complex project setups.

Some shell script projects source many other files at once, for example within a loop. It would be very tedious to define all the needed # shellcheck source= directives to declare where the files are located.

BashSupport Pro’s shell script libraries help you to quickly define this relationship between sets of files.

In the following example, the edited file main.bash sources all shell script files located in directory ./lib.

Example of a bash script with a configured shell script library
Example of a bash script with a configured shell script library

How to Configure Shell Script Libraries

Libraries are defined and stored in the project settings. To allow sharing, paths to files and directories are stored relatively to the project’s base directory. Your IDE’s path variables are supported.

Usually one library is all you need for a project, but you can define any number of libraries. If a file is matched by more than one library, then all are applied.

All definitions found in the library sources, i.e. functions and variables, are made available to all files defined in “Library Usage”. If you need scoped definitions, then shell script libraries are most likely not what you need.

Library Name
The descriptive name of the library to present the library in the user interface.
Library Sources
The list of files and directories defining the library.
All definitions found in the files, i.e. functions and variables, are made available to the files defined in “Library Usage”. Definitions are searched start to end, the first file in the list containing a declaration is considered as the main declaration
Library Usage
The list of files and directories using the definitions found in the library sources.
Recursive
This checkbox is available for configured directories. If turned on, all shell script files found in the directory itself or one of the subdirectories are collected.
Settings of a shell script library
Settings of a shell script library
© 2020–2024 Joachim Ansorg
Impressum
Datenschutz
Rechtliches