Declare a hook’s variables using declare
, making all of them local or global depending on the
context of the macro use. This macro is a wrapper for mbfl_declare_varref()
.
Declare a global hook variable using declare -g
, but define HOOK_NAME using
declare
making it local or global depending on the context of the macro use. This macro is a
wrapper for mbfl_declare_varref()
.
Initialise a new already declared HOOK. If HOOK has been previously used: this function removes all the old registered commands.
Finalise the existent HOOK; all the registered commands are removed. To use again this
variable we have to apply mbfl_hook_define()
to it.
Add to HOOK the command HOOK_COMMAND. When we run the hook: HOOK_COMMAND is executed with:
eval HOOK_COMMAND
If the optional parameter IDVAR is present: it must be the name of a variable in the scope of
the caller, which will be set to a unique identifier associated to the added command; later we can
use such identifier to remove the command with mbfl_hook_remove()
.
Remove from the HOOK the command associated to COMMAND_ID, which must have been obtained
with a previous call to mbfl_hook_remove()
. When successful: return true. If COMMAND_ID
is not a command’s identifier: return false, but nothing else happens.
Return true if HOOK has commands registered for execution; otherwise return false.
Remove all the registered commands in HOOK.
Run all the commands in HOOK, from the first added to the last added.
Run all the commands in HOOK in reverse order, from the last added to the first added.
This document describes version 3.0.0-devel.9 of Marcos Bash Functions Library.