lib/varstash: fix handling of exported vars with Zsh 5.3+

Upstream PR: https://github.com/cxreg/smartcd/pull/51
This commit is contained in:
Daniel Hahler 2017-04-23 21:49:06 +02:00
parent 3fc024eced
commit c018ad8e66
1 changed files with 2 additions and 1 deletions

View File

@ -146,7 +146,8 @@ function stash() {
eval "__varstash_array__$stash_name=(\"\${$stash_which""[@]}\")"
fi
elif [[ $vartype == $pattern" -x"* ]]; then
elif ([[ -n $ZSH_VERSION ]] && [[ $vartype == "export "* ]]) \
|| [[ $vartype == $pattern" -x"* ]]; then
# variable is exported
if [[ -z $already_stashed ]]; then
eval "export __varstash_export__$stash_name=\"\$$stash_which\""