When I use terminal enter zsh, my computer name is garbled, n3-85-8 instead MacBook-Pro. Sometime so as the bash. Do anyone know why? And how to fix it.
There are two effects happening here:
You can configure your computer not to change its hostname (see for example this question). Or, you can configure bash to use the computer's persistent LocalHostName
in the prompt. This value does not change when you connect to a different network.
You can edit your ~/.bashrc
(or related file) to have a line like:
PS1=$(scutil --get LocalHostName)':\W \u\$'