mirror of
				https://github.com/nvm-sh/nvm.git
				synced 2025-11-01 02:35:51 +08:00 
			
		
		
		
	Finds NVM_DIR without using cd
Using `cd` makes the nvm directory the number-one directory in `autojump`'s database---which is somewhat confusing since the user basically never `cd`s to it directly!---so here's an alternative method that doesn't use the `cd` command. I've checked it works in both Bash and Zsh.
This commit is contained in:
		
							
								
								
									
										2
									
								
								nvm.sh
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								nvm.sh
									
									
									
									
									
								
							| @@ -9,7 +9,7 @@ | |||||||
|  |  | ||||||
| # Auto detect the NVM_DIR | # Auto detect the NVM_DIR | ||||||
| if [ ! -d "$NVM_DIR" ]; then | if [ ! -d "$NVM_DIR" ]; then | ||||||
|     export NVM_DIR=$(cd $(dirname ${BASH_SOURCE[0]:-$0}) > /dev/null && pwd) |     export NVM_DIR=$(dirname $(readlink -f ${BASH_SOURCE[0]:-$0})) | ||||||
| fi | fi | ||||||
|  |  | ||||||
| # Make zsh glob matching behave same as bash | # Make zsh glob matching behave same as bash | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user