btw. this looks like duplication of this generic code https://github.com/sm/sm/blob/master/core/internal/shell/package/strategies/gnu/functions#L530-L552 - you should not have to write it, the generic solution should have worked ... unless I'm missing something