mirror of
				https://github.com/nvm-sh/nvm.git
				synced 2025-11-03 22:47:13 +00:00 
			
		
		
		
	Update README.md
Passes all given arguments to cd and respects the outcome of a failed cd.
This commit is contained in:
		
							parent
							
								
									d815374dbd
								
							
						
					
					
						commit
						5f4766d9f6
					
				@ -386,13 +386,8 @@ Put this into your `$HOME/.bashrc` to call `nvm use` automatically whenever you
 | 
			
		||||
```bash
 | 
			
		||||
# place this after nvm initialization!
 | 
			
		||||
cd() {
 | 
			
		||||
	if [ -z "$1" ]
 | 
			
		||||
	then
 | 
			
		||||
		builtin cd
 | 
			
		||||
	else
 | 
			
		||||
		builtin cd $1
 | 
			
		||||
	fi
 | 
			
		||||
	[ -f ".nvmrc" ] && [ -s ".nvmrc" ] && nvm use
 | 
			
		||||
	builtin cd "$@"
 | 
			
		||||
	[ $? -eq 0 ] && [ -f ".nvmrc" ] && [ -s ".nvmrc" ] && nvm use
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user