diff --git a/bash_completions.go b/bash_completions.go index 733f4d121..f32558d03 100644 --- a/bash_completions.go +++ b/bash_completions.go @@ -24,7 +24,7 @@ func writePreamble(buf io.StringWriter, name string) { WriteStringAndCheck(buf, fmt.Sprintf(` __%[1]s_debug() { - if [[ -n ${BASH_COMP_DEBUG_FILE} ]]; then + if [[ -n ${BASH_COMP_DEBUG_FILE-} ]]; then echo "$*" >> "${BASH_COMP_DEBUG_FILE}" fi } diff --git a/zsh_completions.go b/zsh_completions.go index 1afec30ea..4bc4c8521 100644 --- a/zsh_completions.go +++ b/zsh_completions.go @@ -81,7 +81,7 @@ func genZshComp(buf io.StringWriter, name string, includeDesc bool) { __%[1]s_debug() { - local file="$BASH_COMP_DEBUG_FILE" + local file="${BASH_COMP_DEBUG_FILE-}" if [[ -n ${file} ]]; then echo "$*" >> "${file}" fi