summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--Functions/Misc/zed14
2 files changed, 12 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 3fbd9d9b5..6b65e7996 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2022-05-26 Peter Stephenson <p.stephenson@samsung.com>
+
+ * 50286: Functions/Misc/zed: avoid error if nounset is in effect.
+
2022-05-25 Norbert Lange <nolange79@gmail.com>
* github #94: Completion/Linux/Command/_modutils: Support .zst
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