Name

mk_push_vars — Save variables

Synopsis

mk_push_vars vars..

mk_push_vars var=value...

Description

Saves each variable in vars to a safe location and then sets it to the empty string, or if the second form is used, to value. This provides a mechanism for "local variables" that works in any POSIX-compliant shell.

This should only be used once per function, perferably near the top. When used, you must ensure that mk_pop_vars appears near the end of the function, and that it is always reached in any code path.