mirror of
				https://github.com/nvm-sh/nvm.git
				synced 2025-10-31 18:25:52 +08:00 
			
		
		
		
	[Robustness] use backslash when sourcing in case of overridden dot
Fixes #1278.
This commit is contained in:
		
				
					committed by
					
						 Jordan Harband
						Jordan Harband
					
				
			
			
				
	
			
			
			
						parent
						
							942e9ab1f5
						
					
				
				
					commit
					2a2b8bdeb3
				
			| @@ -74,7 +74,7 @@ wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | | |||||||
|  |  | ||||||
| ```sh | ```sh | ||||||
| export NVM_DIR="$HOME/.nvm" | export NVM_DIR="$HOME/.nvm" | ||||||
| [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm | [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
| You can customize the install source, directory, profile, and version using the `NVM_SOURCE`, `NVM_DIR`, `PROFILE`, and `NODE_VERSION` variables. | You can customize the install source, directory, profile, and version using the `NVM_SOURCE`, `NVM_DIR`, `PROFILE`, and `NODE_VERSION` variables. | ||||||
| @@ -124,7 +124,7 @@ Add these lines to your `~/.bashrc`, `~/.profile`, or `~/.zshrc` file to have it | |||||||
|  |  | ||||||
| ```sh | ```sh | ||||||
| export NVM_DIR="$HOME/.nvm" | export NVM_DIR="$HOME/.nvm" | ||||||
| [ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm | [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
| ### Manual upgrade | ### Manual upgrade | ||||||
|   | |||||||
| @@ -297,7 +297,7 @@ nvm_do_install() { | |||||||
|   local INSTALL_DIR |   local INSTALL_DIR | ||||||
|   INSTALL_DIR="$(nvm_install_dir)" |   INSTALL_DIR="$(nvm_install_dir)" | ||||||
|  |  | ||||||
|   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=\"$INSTALL_DIR\"\n[ -s \"\$NVM_DIR/nvm.sh\" ] && \\. \"\$NVM_DIR/nvm.sh\"  # This loads nvm\n" | ||||||
|  |  | ||||||
|   if [ -z "${NVM_PROFILE-}" ] ; then |   if [ -z "${NVM_PROFILE-}" ] ; then | ||||||
|     echo "=> Profile not found. Tried ${NVM_PROFILE} (as defined in \$PROFILE), ~/.bashrc, ~/.bash_profile, ~/.zshrc, and ~/.profile." |     echo "=> Profile not found. Tried ${NVM_PROFILE} (as defined in \$PROFILE), ~/.bashrc, ~/.bash_profile, ~/.zshrc, and ~/.profile." | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user