diff options
author | P. J. McDermott <pj@pehjota.net> | 2016-02-23 13:27:48 (EST) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2016-02-23 13:27:48 (EST) |
commit | fdbd40451bf994699474126353d55aa74f171942 (patch) | |
tree | 29df7e9351d6a95ec7f6c25bde18adfedefbf069 /eshld | |
parent | 5a64eb980d99b7c06522bb9062e5eb29ec960ebe (diff) | |
download | eggshell-fdbd40451bf994699474126353d55aa74f171942.zip eggshell-fdbd40451bf994699474126353d55aa74f171942.tar.gz eggshell-fdbd40451bf994699474126353d55aa74f171942.tar.bz2 |
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
[...]
Diffstat (limited to 'eshld')
-rw-r--r-- | eshld/eshrt.esh | 10 |
1 files changed, 8 insertions, 2 deletions
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}" } |