From fdbd40451bf994699474126353d55aa74f171942 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Tue, 23 Feb 2016 13:27:48 -0500 Subject: eshld/eshrt: Don't run unset with no arguments ksh93 and zsh don't like that: $ ksh93 test Usage: unset [-nfv] name... $ zsh test __fn_ctxsw:unset:24: not enough arguments __fn_ctxsw:unset:24: not enough arguments [...] --- (limited to 'eshld') diff --git a/eshld/eshrt.esh b/eshld/eshrt.esh index 9efbbe0..7e03ef2 100644 --- a/eshld/eshrt.esh +++ b/eshld/eshrt.esh @@ -85,7 +85,11 @@ __fn_ctxsw() ${__fn_tu});; ?*) # Unset static variables and functions from previous TU. - eval "unset \${__${__prev_tu}_static_vars}" + case "$(eval "printf '%s' \ + \"\${__${__prev_tu}_static_vars}\"")" \ + in ?*) + eval "unset \${__${__prev_tu}_static_vars}" + ;; esac for __fn in $(eval printf '%s' \ "\"\${__${__prev_tu}_static_fns}\""); do unset -f "${__fn%:*}" @@ -102,7 +106,9 @@ __fn_ctxsw() eval "${__fn%:*}() { ${__fn#*:}; }" done ;; esac - unset ${__prev_vars} + case "${__prev_vars}" in ?*) + unset ${__prev_vars} + ;; esac eval "${__fn_var_vals}" } -- cgit v0.9.1