Install NVM on FreeBSD

Lots of Linuxisms and Bashism happening. Let's enlighten the world.
Add this to "~/.shrc"
# Node version manager
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
Add this to "~/.profile"
NVM_DIR="$HOME/.nvm"; export NVM_DIR
Then clone to "~/.nvm"
export NVM_DIR="$HOME/.nvm"
git clone https://github.com/nvm-sh/nvm.git "$NVM_DIR"
cd "$NVM_DIR"
git checkout `git describe --abbrev=0 --tags --match "v[0-9]*" $(git rev-list --tags --max-count=1)`
\. "$NVM_DIR/nvm.sh"