mirror of
				https://github.com/ohmyzsh/ohmyzsh.git
				synced 2025-11-04 13:21:19 +08:00 
			
		
		
		
	fix(init): ensure hostname is always valid for macOS (#13171)
This commit is contained in:
		
							parent
							
								
									042605ee6b
								
							
						
					
					
						commit
						2fbdfa93f9
					
				@ -99,8 +99,8 @@ done
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# Figure out the SHORT hostname
 | 
					# Figure out the SHORT hostname
 | 
				
			||||||
if [[ "$OSTYPE" = darwin* ]]; then
 | 
					if [[ "$OSTYPE" = darwin* ]]; then
 | 
				
			||||||
  # macOS's $HOST changes with dhcp, etc. Use ComputerName if possible.
 | 
					  # macOS's $HOST changes with dhcp, etc. Use LocalHostName if possible.
 | 
				
			||||||
  SHORT_HOST=$(scutil --get ComputerName 2>/dev/null) || SHORT_HOST="${HOST/.*/}"
 | 
					  SHORT_HOST=$(scutil --get LocalHostName 2>/dev/null) || SHORT_HOST="${HOST/.*/}"
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
  SHORT_HOST="${HOST/.*/}"
 | 
					  SHORT_HOST="${HOST/.*/}"
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user