mirror of
				https://github.com/nvm-sh/nvm.git
				synced 2025-10-31 18:25:52 +08:00 
			
		
		
		
	updated output without special characters (tab; \t)
Omit duplicate 'finish line' normalized indentation
This commit is contained in:
		| @@ -46,24 +46,25 @@ SOURCE_STR="[ -s \"$NVM_DIR/nvm.sh\" ] && . \"$NVM_DIR/nvm.sh\"  # This loads NV | |||||||
|  |  | ||||||
| if [ -z "$PROFILE" ] || [ ! -f "$PROFILE" ] ; then | if [ -z "$PROFILE" ] || [ ! -f "$PROFILE" ] ; then | ||||||
|   if [ -z $PROFILE ]; then |   if [ -z $PROFILE ]; then | ||||||
|     echo "=> Profile not found" |     echo "=> Profile not found. Tried ~/.bash_profile ~/.zshrc and ~/.profile." | ||||||
|  |     echo "=> Create one of them and run this script again" | ||||||
|   else |   else | ||||||
|     echo "=> Profile $PROFILE not found" |     echo "=> Profile $PROFILE not found" | ||||||
|  |     echo "=> Create it (touch $PROFILE) and run this script again" | ||||||
|   fi |   fi | ||||||
|   echo "=> Append the following line to the correct file yourself" |   echo "   OR" | ||||||
|  |   echo "=> Append the following line to the correct file yourself:" | ||||||
|   echo |   echo | ||||||
|   echo "\t$SOURCE_STR" |   echo "   $SOURCE_STR" | ||||||
|   echo |   echo | ||||||
|   echo "=> Close and reopen your terminal to start using NVM" |  | ||||||
|   exit |  | ||||||
| fi |  | ||||||
|  |  | ||||||
| if ! grep -qc 'nvm.sh' $PROFILE; then |  | ||||||
|   echo "=> Appending source string to $PROFILE" |  | ||||||
|   echo "" >> "$PROFILE" |  | ||||||
|   echo $SOURCE_STR >> "$PROFILE" |  | ||||||
| else | else | ||||||
|   echo "=> Source string already in $PROFILE" |   if ! grep -qc 'nvm.sh' $PROFILE; then | ||||||
|  |     echo "=> Appending source string to $PROFILE" | ||||||
|  |     echo "" >> "$PROFILE" | ||||||
|  |     echo $SOURCE_STR >> "$PROFILE" | ||||||
|  |   else | ||||||
|  |     echo "=> Source string already in $PROFILE" | ||||||
|  |   fi | ||||||
| fi | fi | ||||||
|  |  | ||||||
| echo "=> Close and reopen your terminal to start using NVM" | echo "=> Close and reopen your terminal to start using NVM" | ||||||
|   | |||||||
							
								
								
									
										33
									
								
								install.sh
									
									
									
									
									
								
							
							
						
						
									
										33
									
								
								install.sh
									
									
									
									
									
								
							| @@ -43,30 +43,25 @@ SOURCE_STR="[ -s \"$NVM_DIR/nvm.sh\" ] && . \"$NVM_DIR/nvm.sh\"  # This loads NV | |||||||
|  |  | ||||||
| if [ -z "$PROFILE" ] || [ ! -f "$PROFILE" ] ; then | if [ -z "$PROFILE" ] || [ ! -f "$PROFILE" ] ; then | ||||||
|   if [ -z $PROFILE ]; then |   if [ -z $PROFILE ]; then | ||||||
| 	echo "=> Profile not found. Tried $HOME/.bash_profile and $HOME/.profile" |     echo "=> Profile not found. Tried ~/.bash_profile ~/.zshrc and ~/.profile." | ||||||
|  |     echo "=> Create one of them and run this script again" | ||||||
|   else |   else | ||||||
| 	echo "=> Profile $PROFILE not found" |     echo "=> Profile $PROFILE not found" | ||||||
|  |     echo "=> Create it (touch $PROFILE) and run this script again" | ||||||
|   fi |   fi | ||||||
|   echo "=> Run this script again after running the following:" |   echo "   OR" | ||||||
|  |   echo "=> Append the following line to the correct file yourself:" | ||||||
|   echo |   echo | ||||||
|   echo "\ttouch $HOME/.profile" |   echo "   $SOURCE_STR" | ||||||
|   echo |   echo | ||||||
|   echo "-- OR --" |  | ||||||
|   echo |  | ||||||
|   echo "=> Append the following line to the correct file yourself" |  | ||||||
|   echo |  | ||||||
|   echo "\t$SOURCE_STR" |  | ||||||
|   echo |  | ||||||
|   echo "=> Close and reopen your terminal afterwards to start using NVM" |  | ||||||
|   exit |  | ||||||
| fi |  | ||||||
|  |  | ||||||
| if ! grep -qc 'nvm.sh' $PROFILE; then |  | ||||||
|   echo "=> Appending source string to $PROFILE" |  | ||||||
|   echo "" >> "$PROFILE" |  | ||||||
|   echo $SOURCE_STR >> "$PROFILE" |  | ||||||
| else | else | ||||||
|   echo "=> Source string already in $PROFILE" |   if ! grep -qc 'nvm.sh' $PROFILE; then | ||||||
|  |     echo "=> Appending source string to $PROFILE" | ||||||
|  |     echo "" >> "$PROFILE" | ||||||
|  |     echo $SOURCE_STR >> "$PROFILE" | ||||||
|  |   else | ||||||
|  |     echo "=> Source string already in $PROFILE" | ||||||
|  |   fi | ||||||
| fi | fi | ||||||
|  |  | ||||||
| echo "=> Close and reopen your terminal to start using NVM" | echo "=> Close and reopen your terminal to start using NVM" | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user