mirror of
				https://github.com/nvm-sh/nvm.git
				synced 2025-10-31 10:15:53 +08:00 
			
		
		
		
	Update to replace an old nvm path if it exists already in $PATH.
This commit is contained in:
		
							
								
								
									
										6
									
								
								nvm.sh
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								nvm.sh
									
									
									
									
									
								
							| @@ -78,8 +78,12 @@ nvm() | |||||||
|         nvm help |         nvm help | ||||||
|         return; |         return; | ||||||
|       fi |       fi | ||||||
|       # TODO: Remove old nvm paths before adding this one |       if [[ $PATH == *$NVM_DIR/*/bin* ]]; then | ||||||
|  |         PATH=${PATH%$NVM_DIR/*/bin*}$NVM_DIR/$2/bin${PATH#*$NVM_DIR/*/bin} | ||||||
|  |       else | ||||||
|         PATH="$NVM_DIR/$2/bin:$PATH" |         PATH="$NVM_DIR/$2/bin:$PATH" | ||||||
|  |       fi | ||||||
|  |       export PATH | ||||||
|       echo "Now using node $2" |       echo "Now using node $2" | ||||||
|     ;; |     ;; | ||||||
|     "list" ) |     "list" ) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user