Repository: nvm
Issue: zsh commands output by install.sh have syntax issues
Labels: shell: zsh,needs followup

<!-- Thank you for being interested in nvm! Please help us by filling out the following form if you‘re having trouble. If you have a feature request, or some other question, please feel free to clear out the form. Thanks! -->

#### Operating system and version:

Linux 6.11.3-200.fc40.x86_64 # 1 SMP PREEMPT_DYNAMIC Thu Oct 10 22:31:19 UTC 2024 x86_64 GNU/Linux

#### `nvm debug` output:
<details>
<!-- do not delete the following blank line -->

```sh
> nvm debug
nvm --version: v0.40.1
$SHELL: /bin/zsh
$SHLVL: 1
whoami: 'vernica'
${HOME}: /home/vernica
${NVM_DIR}: '${HOME}/.nvm'
${PATH}: ${HOME}/local/bin:${HOME}/.local/bin:${HOME}/go/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin
$PREFIX: ''
${NPM_CONFIG_PREFIX}: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'zsh 5.9 (x86_64-redhat-linux-gnu)'
uname -a: 'Linux 6.11.3-200.fc40.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Oct 10 22:31:19 UTC 2024 x86_64 GNU/Linux'
checksum binary: 'sha256sum'
OS version: Fedora Linux 40 (Workstation Edition)
awk: /usr/bin/awk, GNU Awk 5.3.0, API 4.0, PMA Avon 8-g1, (GNU MPFR 4.2.1, GNU MP 6.2.1)
curl: /usr/bin/curl, curl 8.6.0 (x86_64-redhat-linux-gnu) libcurl/8.6.0 OpenSSL/3.2.2 zlib/1.3.1.zlib-ng brotli/1.1.0 libidn2/2.3.7 libpsl/0.21.5 libssh/0.10.6/openssl/zlib nghttp2/1.59.0 OpenLDAP/2.6.7
wget: /usr/bin/wget, GNU Wget2 2.1.0 - multithreaded metalink/file/website downloader
git: /usr/bin/git, git version 2.47.0
ls: cannot access 'grep='\''grep'$'\n''/usr/bin/grep': No such file or directory
grep: grep='grep --color=auto'
	/usr/bin/grep (grep --color=auto), grep (GNU grep) 3.11
sed: /usr/bin/sed, sed (GNU sed) 4.9
cut: /usr/bin/cut, cut (GNU coreutils) 9.4
basename: /usr/bin/basename, basename (GNU coreutils) 9.4
ls: cannot access 'rm='\''rm'$'\n''/usr/bin/rm': No such file or directory
rm: rm='rm -i'
	/usr/bin/rm (rm -i), rm (GNU coreutils) 9.4
mkdir: /usr/bin/mkdir, mkdir (GNU coreutils) 9.4
xargs: /usr/bin/xargs, xargs (GNU findutils) 4.9.0
nvm current: system
which node: /usr/bin/node
which iojs: iojs not found
which npm: /usr/bin/npm
npm config get prefix: /usr/local
npm root -g: /usr/local/lib/node_modules
```
</details>

#### `nvm ls` output:
<details>
<!-- do not delete the following blank line -->

```sh
> nvm ls

->       system
iojs -> N/A (default)
node -> stable (-> N/A) (default)
unstable -> N/A (default)
```
</details>

#### How did you install `nvm`?
<!-- (e.g. install script in readme, Homebrew) -->
```
> curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
```

#### What steps did you perform?
```
> curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
```

#### What happened?
I copied and pasted the lines as the install script instructed and they show errors in ZSH:
```
> curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
...
=> Downloading nvm from git to '/home/vernica/.nvm'
=> Cloning into '/home/vernica/.nvm'...
...
=> Compressing and cleaning up git repository

=> Appending nvm source string to /home/vernica/.zshrc
=> Appending bash_completion source string to /home/vernica/.zshrc
=> Close and reopen your terminal to start using nvm or run the following to use it now:

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion


> export NVM_DIR="$HOME/.nvm" 
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

zsh: bad pattern: #
```

#### What did you expect to happen?

The commands output by the script should not have syntax errors.

#### Is there anything in any of your profile files that modifies the `PATH`?
<!--  (e.g. `.bashrc`, `.bash_profile`, `.zshrc`, etc) -->

```
> grep -i PATH ~/.zshrc
fpath=(~/local/completion $fpath)
## -- - PATH - --
path=("$HOME/local/bin" "$HOME/.local/bin" "$HOME/go/bin" $path)
export NODE_PATH=$HOME/usr/lib/node_modules
#         export PATH="/home/vernica/miniforge3/bin:$PATH"
```