summaryrefslogtreecommitdiff
path: root/Functions
diff options
context:
space:
mode:
authorPeter Stephenson <p.stephenson@samsung.com>2022-05-26 09:32:33 +0100
committerPeter Stephenson <p.stephenson@samsung.com>2022-05-26 09:32:33 +0100
commit92da264eea88582d51c9932b6233863298f79016 (patch)
treea827a4dceb837e8ba9af8b75bc73c81e9d409527 /Functions
parentdd2c882ae1928d36796373fb5375040ce93aa998 (diff)
downloadzsh-92da264eea88582d51c9932b6233863298f79016.tar.gz
zsh-92da264eea88582d51c9932b6233863298f79016.zip
50286: avoid zed error if nounset is in effect
Diffstat (limited to 'Functions')
-rw-r--r--Functions/Misc/zed14
1 files changed, 8 insertions, 6 deletions
diff --git a/Functions/Misc/zed b/Functions/Misc/zed
index 7d0d590db..bb075512c 100644
--- a/Functions/Misc/zed
+++ b/Functions/Misc/zed
@@ -14,15 +14,17 @@ local var opts zed_file_name
integer TMOUT=0 okargs=1 fun hist bind
local -a expand
-zparseopts -D -A opts f h b x:
+zparseopts -D -A opts f h b x: || return 1
fun=$+opts[-f]
hist=$+opts[-h]
bind=$+opts[-b]
-if [[ $opts[-x] == <-> ]]; then
- expand=(-x $opts[-x])
-elif (( $+opts[-x] )); then
- print -r "Integer expected after -x: $opts[-x]" >&2
- return 1
+if (( $+opts[-x] )); then
+ if [[ $opts[-x] == <-> ]]; then
+ expand=(-x $opts[-x])
+ else
+ print -r "Integer expected after -x: $opts[-x]" >&2
+ return 1
+ fi
fi
[[ $0 = fned ]] && fun=1