creationix/nvm — pull request #278 by frasertweedale (2013-08-10 07:21:00+00:00)
Title: fix MANPATH generation on FreeBSD

FOREWORD: I have tested this on FreeBSD and GNU+Linux (Ubuntu
13.04). I have not been able to test on Mac OS X, so hopefully a
maintainer can...

On FreeBSD, if MANPATH is set it is used verbatim; configuration
files are completely ignored. Therefore, setting MANPATH to (only)
the nvm man dir makes system man pages unreachable.

To get around this, before doing anything else to MANPATH, if it is
empty set it to the output of manpath(1).

One further complication: FreeBSD automatically adds a path to the
man pages path for each path in PATH that ends in "/bin", which
causes "~/.nvm/$VERSION/man" to be added. This interferes with the
subsequent substitution so strip this from MANPATH before the
substitution.