summaryrefslogtreecommitdiff
path: root/lib/functions.zsh
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2019-09-11 18:19:51 -0600
committerTuowen Zhao <ztuowen@gmail.com>2019-09-11 18:19:51 -0600
commitd676c1553254309beca5bb9a8edb43fbe09a7169 (patch)
treed0bb04b6487e6fedbb2b2370a894fccd19d4c567 /lib/functions.zsh
parentfb141c2257f648cd29b64cbd3f2ca9123f6e427f (diff)
parentddd359dd668f448856438304bedfe952d1749efd (diff)
downloadzsh-d676c1553254309beca5bb9a8edb43fbe09a7169.tar.gz
zsh-d676c1553254309beca5bb9a8edb43fbe09a7169.tar.bz2
zsh-d676c1553254309beca5bb9a8edb43fbe09a7169.zip
Merge remote-tracking branch 'orig/master'
Diffstat (limited to 'lib/functions.zsh')
-rw-r--r--lib/functions.zsh6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/functions.zsh b/lib/functions.zsh
index 4ef8920f6..9f8736bd7 100644
--- a/lib/functions.zsh
+++ b/lib/functions.zsh
@@ -79,7 +79,7 @@ function try_alias_value() {
# 0 if the variable exists, 3 if it was set
#
function default() {
- test `typeset +m "$1"` && return 0
+ (( $+parameters[$1] )) && return 0
typeset -g "$1"="$2" && return 3
}
@@ -93,8 +93,8 @@ function default() {
# 0 if the env variable exists, 3 if it was set
#
function env_default() {
- env | grep -q "^$1=" && return 0
- export "$1=$2" && return 3
+ (( ${${(@f):-$(typeset +xg)}[(I)$1]} )) && return 0
+ export "$1=$2" && return 3
}