@MikeMcQuaid There's no performance difference between three lines and one, or between `source` and `.`, and there are more caveats with a variety of styles anyway, but since you asked I normalized every formula touched here to POSIX `test` (`[`) and `.`, converted single pipeline conditionals to lists, and removed quotes around paths (fewer existing paths were quoted than not, and Homebrew shouldn't be installed to a path that needs quoting anyway, or many build or runtime scripts would break).
Forgot to mention: `#{HOMEBREW_PREFIX}` and `#{etc}` are already (more) widely used in such caveats. A very crude search:
```sh
for f in Formula/*; do sed -n '/def caveats/,/plist/p' $f | grep -e HOMEBREW_PREFIX -e '#{etc}' && echo $f; done | grep -v plist_options
```
caveats: eliminate `brew --prefix` calls in shell rcs
=====================================================
- [x] Have you followed the [guidelines for contributing](https://github.com/Homebrew/homebrew-core/blob/master/CONTRIBUTING.md)?
- [x] Have you checked that there aren't other open [pull requests](https://github.com/Homebrew/homebrew-core/pulls) for the same formula update/change?
- [x] Have you built your formula locally with `brew install --build-from-source <formula>`, where `<formula>` is the name of the formula you're submitting?
- [x] Does your build pass `brew audit --strict <formula>` (after doing `brew install <formula>`)?
-----
`brew --prefix` is slow, while shell rcs have to be fast. On my mid-2015 15'' rMBP with 2.5 GHz i7 and 512 GB SSD, `brew --prefix` takes 40–50 ms:
```zsh
$ time (repeat 1000 brew --prefix >/dev/null)
( repeat 1000; do; brew --prefix > /dev/null; done; ) 23.20s user 18.35s system 82% cpu 50.538 total
```
It should be slower on HDD and worse still on NFS and likes. Moreover, `brew --prefix` is often called in a construct like
```sh
[ -f "$(brew --prefix)/path/to/script" ] && . "$(brew --prefix)/path/to/script"
```
i.e., it is called twice, consuming ~100 ms. As someone who has been obsessed with the art of Zsh customizations for years, I can confidently say that a 100 ms delay during shell init is in the noticeable range. We don't want to inflate shell init time of unsuspecting users; meanwhile, those advanced users who want to have a set of shell rcs that work accross multiple hosts with brew installed at different locations, or those who have multiple brew installations on a single host that are dynamically switched should know how to use `brew --prefix` (or better, use different hardcoded values for different values for different hosts) without us telling them.
This PR replaces all `$(brew --prefix)/...` in caveats with `#{HOMEBREW_PREFIX}/...` or `#{etc}/...`.
Note that `dvm` is also revisioned to use standard `bash_completion.install`, so if merged bottle needs to be pulled for `dvm`.