mirror of
				https://github.com/nvm-sh/nvm.git
				synced 2025-10-31 18:25:52 +08:00 
			
		
		
		
	[Refactor]Double quote to prevent globbing and word splitting.
This commit is contained in:
		| @@ -69,7 +69,7 @@ install_nvm_from_git() { | |||||||
|     mkdir -p "$NVM_DIR" |     mkdir -p "$NVM_DIR" | ||||||
|     command git clone "$(nvm_source git)" "$NVM_DIR" |     command git clone "$(nvm_source git)" "$NVM_DIR" | ||||||
|   fi |   fi | ||||||
|   cd "$NVM_DIR" && command git checkout --quiet $(nvm_latest_version) |   cd "$NVM_DIR" && command git checkout --quiet "$(nvm_latest_version)" | ||||||
|   if [ ! -z "$(cd "$NVM_DIR" && git show-ref refs/heads/master)" ]; then |   if [ ! -z "$(cd "$NVM_DIR" && git show-ref refs/heads/master)" ]; then | ||||||
|     if git branch --quiet 2>/dev/null; then |     if git branch --quiet 2>/dev/null; then | ||||||
|       cd "$NVM_DIR" && command git branch --quiet -D master >/dev/null 2>&1 |       cd "$NVM_DIR" && command git branch --quiet -D master >/dev/null 2>&1 | ||||||
| @@ -123,15 +123,15 @@ nvm_detect_profile() { | |||||||
|   local DETECTED_PROFILE |   local DETECTED_PROFILE | ||||||
|   DETECTED_PROFILE='' |   DETECTED_PROFILE='' | ||||||
|   local SHELLTYPE |   local SHELLTYPE | ||||||
|   SHELLTYPE="$(basename /$SHELL)" |   SHELLTYPE="$(basename "/$SHELL")" | ||||||
|  |  | ||||||
|   if [ $SHELLTYPE = "bash" ]; then |   if [ "$SHELLTYPE" = "bash" ]; then | ||||||
|     if [ -f "$HOME/.bashrc" ]; then |     if [ -f "$HOME/.bashrc" ]; then | ||||||
|       DETECTED_PROFILE="$HOME/.bashrc" |       DETECTED_PROFILE="$HOME/.bashrc" | ||||||
|     elif [ -f "$HOME/.bash_profile" ]; then |     elif [ -f "$HOME/.bash_profile" ]; then | ||||||
|       DETECTED_PROFILE="$HOME/.bash_profile" |       DETECTED_PROFILE="$HOME/.bash_profile" | ||||||
|     fi |     fi | ||||||
|   elif [ $SHELLTYPE = "zsh" ]; then |   elif [ "$SHELLTYPE" = "zsh" ]; then | ||||||
|     DETECTED_PROFILE="$HOME/.zshrc" |     DETECTED_PROFILE="$HOME/.zshrc" | ||||||
|   fi |   fi | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user