From c1ffe80d61d1b4a71c33128023894a33738f9776 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Mon, 1 Apr 2024 21:45:05 +0000 Subject: [PATCH] fix: bash completion fallback in `nounset` mode With the shell in `nounset` mode, the intended fallback to filename completion provokes an error: ``` $ cargo foo bash: !opt_var: unbound variable ``` --- src/etc/cargo.bashcomp.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/etc/cargo.bashcomp.sh b/src/etc/cargo.bashcomp.sh index c0ba62752c0..dad16dd99e3 100644 --- a/src/etc/cargo.bashcomp.sh +++ b/src/etc/cargo.bashcomp.sh @@ -154,7 +154,7 @@ _cargo() else local opt_var=opt__${cmd//-/_} fi - if [[ -z "${!opt_var}" ]]; then + if [[ -z "${!opt_var-}" ]]; then # Fallback to filename completion. _filedir else