mirror of
https://github.com/nvm-sh/nvm.git
synced 2026-07-18 12:58:21 +08:00
[Refactor] nvm_alias: use [[:space:]] instead of literal tab
[Tests] `nvm_alias`: add edge-case tests for hostile file content
This commit is contained in:
@@ -1374,13 +1374,12 @@ nvm_alias() {
|
||||
while IFS= read -r NVM_ALIAS_LINE || [ -n "${NVM_ALIAS_LINE}" ]; do
|
||||
NVM_ALIAS_LINE="${NVM_ALIAS_LINE%%#*}"
|
||||
case "${NVM_ALIAS_LINE}" in
|
||||
*[!\ \ ]*) ;;
|
||||
*[![:space:]]*) ;;
|
||||
*) continue ;;
|
||||
esac
|
||||
while : ; do
|
||||
case "${NVM_ALIAS_LINE}" in
|
||||
*' ') NVM_ALIAS_LINE="${NVM_ALIAS_LINE% }" ;;
|
||||
*' ') NVM_ALIAS_LINE="${NVM_ALIAS_LINE% }" ;;
|
||||
*[[:space:]]) NVM_ALIAS_LINE="${NVM_ALIAS_LINE%[[:space:]]}" ;;
|
||||
*) break ;;
|
||||
esac
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user