Redo https://github.com/creationix/nvm/pull/345
Remove some new bashisms
Missed tests
tests: avoid reliance on nullglob

Some shells do not have a nullglob feature, including dash (default
/bin/sh on Ubuntu) and the Almquist shell (default /bin/sh on
FreeBSD).  An mv(1) command in setup_dir is failing due to a glob
not matching anything, so use a more widely supported construction.
fix ls command in dash

The `colorize_version` command fails in dash (default /bin/sh on
Ubuntu) with an error like:

  local: v0.2.3: bad variable name

Instead of using a local variable, interpolate the function argument
directly to avoid the error.
fix errors and portability issues in expr commands

Add double-quotes around all expr(1) left-hand-sides where the
argument is just a variable, to prevent syntax errors when the
variable is empty.

Also avoid the `expr match ...` variant as this is not defined in
POSIX and causes errors in some implementations, including
FreeBSD's.
fix errors due to use of unportable == operator

The `==` operator is not defined by POSIX and many test(1) (also
spelled `[`) implementations do not support it.  Replace uses of
`==` with the POSIX-conformant `=` equality operator.
fix logic error in nvm deactivate test
handle echo implementations that do not support `-e`
fix explicit version matching on FreeBSD

FreeBSD's regular expression library does not like the pattern used
for matching explicit version strings in `nvm_ls`.  Change the
pattern to something more specific that works on FreeBSD.
avoid nullglob in alias command
colorize output only if echo supports it
address remaining comments from #363
fix install from source on FreeBSD 10

Compile with CXX=c++ on FreeBSD, as FreeBSD >= 10.0 no longer has
GCC in the base system (c++ is hardlinked to clang++ on FreeBSD 10.0
and g++ on FreeBSD < 10).
remove duplicate install test

`test/slow/install` is identical to `test/slow/install from source`
except in the version installed.  Remove it.
use a more portable release in install tests

The tests for nvm install currently install v0.8.6, which doesn't
build on FreeBSD due to Linuxisms.  Switch to a more recent version
that does work.
Merge pull request #364 from frasertweedale/fix/portability

Fix/portability