mirror of
				https://github.com/nvm-sh/nvm.git
				synced 2025-10-31 10:15:53 +08:00 
			
		
		
		
	[Fix] install.sh: only un-interpolate $HOME for the profile source string.
				
					
				
			Fixes #1384.
This commit is contained in:
		
							
								
								
									
										10
									
								
								install.sh
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								install.sh
									
									
									
									
									
								
							| @@ -7,7 +7,7 @@ nvm_has() { | |||||||
| } | } | ||||||
|  |  | ||||||
| nvm_install_dir() { | nvm_install_dir() { | ||||||
|   printf %s "${NVM_DIR:-"$HOME/.nvm"}" | sed "s:^$HOME:\$HOME:" |   printf %s "${NVM_DIR:-"$HOME/.nvm"}" | ||||||
| } | } | ||||||
|  |  | ||||||
| nvm_latest_version() { | nvm_latest_version() { | ||||||
| @@ -290,10 +290,10 @@ nvm_do_install() { | |||||||
|  |  | ||||||
|   local NVM_PROFILE |   local NVM_PROFILE | ||||||
|   NVM_PROFILE="$(nvm_detect_profile)" |   NVM_PROFILE="$(nvm_detect_profile)" | ||||||
|   local INSTALL_DIR |   local PROFILE_INSTALL_DIR | ||||||
|   INSTALL_DIR="$(nvm_install_dir)" |   PROFILE_INSTALL_DIR="$(nvm_install_dir| sed "s:^$HOME:\$HOME:")" | ||||||
|  |  | ||||||
|   SOURCE_STR="\nexport NVM_DIR=\"$INSTALL_DIR\"\n[ -s \"\$NVM_DIR/nvm.sh\" ] && \\. \"\$NVM_DIR/nvm.sh\"  # This loads nvm\n" |   SOURCE_STR="\nexport NVM_DIR=\"${PROFILE_INSTALL_DIR}\"\n[ -s \"\$NVM_DIR/nvm.sh\" ] && \\. \"\$NVM_DIR/nvm.sh\"  # This loads nvm\n" | ||||||
|   COMPLETION_STR="[ -s \"\$NVM_DIR/bash_completion\" ] && \\. \"\$NVM_DIR/bash_completion\"  # This loads nvm bash_completion\n" |   COMPLETION_STR="[ -s \"\$NVM_DIR/bash_completion\" ] && \\. \"\$NVM_DIR/bash_completion\"  # This loads nvm bash_completion\n" | ||||||
|   BASH_OR_ZSH=false |   BASH_OR_ZSH=false | ||||||
|  |  | ||||||
| @@ -331,7 +331,7 @@ nvm_do_install() { | |||||||
|  |  | ||||||
|   # Source nvm |   # Source nvm | ||||||
|   # shellcheck source=/dev/null |   # shellcheck source=/dev/null | ||||||
|   \. "${INSTALL_DIR}/nvm.sh" |   \. "$(nvm_install_dir)/nvm.sh" | ||||||
|  |  | ||||||
|   nvm_check_global_modules |   nvm_check_global_modules | ||||||
|  |  | ||||||
|   | |||||||
| @@ -19,7 +19,7 @@ unset NVM_DIR | |||||||
|  |  | ||||||
| # NVM_DIR is not set | # NVM_DIR is not set | ||||||
| install_dir=$(nvm_install_dir) | install_dir=$(nvm_install_dir) | ||||||
| [ "_$install_dir" = "_\$HOME/.nvm" ] || die "nvm_install_dir should default to \$HOME/.nvm. Current output: $install_dir" | [ "_$install_dir" = "_$HOME/.nvm" ] || die "nvm_install_dir should default to \$HOME/.nvm. Current output: $install_dir" | ||||||
|  |  | ||||||
| cleanup | cleanup | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user