6.3.3 Nested function calls

Remember that the handlers are called when a location is left:

declare RESULT

function handler_append () {
    local THING=${1:?"missing thing parameter"}
    RESULT+=$THING
}

function func () {
    handler_append 0
    mbfl_location_enter
    {
        sub-func
    }
    mbfl_location_leave
    handler_append 6
}

function sub-func () {
    mbfl_location_handler "handler_append 1"
    mbfl_location_enter
    {
        sub-sub-func
    }
    mbfl_location_leave
    mbfl_location_handler "handler_append 5"
}

function sub-sub-func () {
    mbfl_location_handler "handler_append 2"
    mbfl_location_enter
    {
        mbfl_location_handler "handler_append 3"
    }
    mbfl_location_leave
    mbfl_location_handler "handler_append 4"
}

func
"$RESULT"       ⇒ 0342516

This document describes version 3.0.0-devel.9 of Marcos Bash Functions Library.