Code cleanup

4 commits that cleanup code by using more shell built-ins.
The [second line of `nvm.sh`](../blob/10305f07911009f4bcaeff0169c6d6182e123f97/nvm.sh#L2) says:
```
# Implemented as a bash function
```