Handle undeclared POSIXLY_CORRECT in Bash completions

As of `brew` 4.0.2, sourcing the Bash completions with `set -eu` causes a
failure if `POSIXLY_CORRECT` is not declared. The check will now
properly handle this situation.

I'm not sure if the resulting code is POSIX-compliant, but it prevents a
breaking change until a better solution can be found.
This commit is contained in:
Alex Hedges 2023-02-20 18:36:59 -05:00
parent 4eaaa867de
commit 5ed06a7956

View File

@ -15,7 +15,7 @@
# This file is automatically generated by running `brew generate-man-completions`.
# See Library/Homebrew/completions/bash.erb for editing instructions.
if [[ -n ${POSIXLY_CORRECT} ]] || shopt -oq posix
if [[ -n ${POSIXLY_CORRECT:-} ]] || shopt -oq posix
then
echo "Homebrew Bash completions do not work in POSIX mode" 1>&2
return