[Fix] prevent sed errors when pattern contains `#`
Before adoption: this commit came in with the history the project adopted, so no landing records it.
When `.nvmrc` or alias files contained comments (lines with `#`), the `#` character could end up in the search pattern passed to sed, causing "unterminated regular expression" errors because `#` is used as the sed address delimiter. This commit fixes the issue in two places: 1. `nvm_alias`: Strip comments from alias file contents before returning them, and trim trailing whitespace 2. `nvm_ls`: Escape `#` characters in SEARCH_PATTERN so they're treated as literal characters in the sed address Fixes #3761
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
3 files+58 added−2 removed
- tests:+56 added−0 removed
- other:+2 added−2 removed