bash completion should not call brew if brew doesn't exist
In the section "Configuring Completions in `bash`", there's a line of code that sets `HOMEBREW_PREFIX` by calling `brew --prefix`, but it's done before calling `type brew` to see if brew exists. This gives a "-bash: brew: command not found" if you don't have brew installed. That line should be moved inside the `if`.
This commit is contained in:
parent
6c2b9ffdc1
commit
c296c5f2d3
@ -11,8 +11,8 @@ You must configure your shell to enable its completion support. This is because
|
||||
To make Homebrew's completions available in `bash`, you must source the definitions as part of your shell's startup. Add the following to your `~/.bash_profile` file:
|
||||
|
||||
```sh
|
||||
HOMEBREW_PREFIX=$(brew --prefix)
|
||||
if type brew &>/dev/null; then
|
||||
HOMEBREW_PREFIX=$(brew --prefix)
|
||||
if [[ -r "${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh" ]]; then
|
||||
source "${HOMEBREW_PREFIX}/etc/profile.d/bash_completion.sh"
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user