mirror of
				https://github.com/nvm-sh/nvm.git
				synced 2025-11-03 22:47:13 +00:00 
			
		
		
		
	In zsh nvm fails to deduce nvm's directory from nvm.sh, because `$BASH_SOURCE` is not present in zsh. Use the directory of `$0`, if its filename is `nvm.sh`. We use `$BASH_SOUCE` in bash, `$0` in zsh (and similar) and fallback to `~/.nvm` otherwise.
		
			
				
	
	
		
			9 lines
		
	
	
		
			134 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			9 lines
		
	
	
		
			134 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
#!/bin/sh
 | 
						|
 | 
						|
echo Testing bash
 | 
						|
bash -c '. ../../nvm.sh'
 | 
						|
echo Testing zsh
 | 
						|
zsh -c '. ../../nvm.sh'
 | 
						|
echo Testing sh
 | 
						|
sh -c '. ../../nvm.sh'
 |