SHTK_IMPORT(3) | Library Functions Manual | SHTK_IMPORT(3) |
shtk_import
—
Loads an shtk module
Built-in function; automatically loaded.
shtk_import |
module |
The shtk_import
function imports the shtk
module specified by module into the currently-running
script. Requests to import a module are idempotent, so it is acceptable to
import the same module multiple times.
Modules are first searched for in the collection of directories provided by the user in the colon-separated environment variable SHTK_MODULESPATH. If this variable is not defined, or if the module is not found in any of the specified directories, then the built-in directory /usr/local/share/shtk is used.
Because shell scripts have no namespaces, an import of a module makes the module available script-wide regardless of where the import happens. Therefore, it is possible for an import of a module to import other modules, and for those indirectly-imported modules to be visible in your script. Good programming practice dictates that you should not rely on these implicit imports and always explicitly declare all the modules you use.
The requested module must exist so
shtk_import
aborts execution if the module is not
present.
shtk_import
modules.shtk_import
first appeared in
shtk
1.0.
November 4, 2014 | Debian |