There is a problem with my .zshrc file. I want to customise my .zshrc on macOS Catalina. Therefore I added the following to my .zshrc:
export PS1='[\u@\h \$'
Then I called source .zshrc
and got the following output:
Is there any solution to display the user and hostname properly?
http://zsh.sourceforge.net/Guide/zshguide02.html#l19
PS1='%n@%m %(!:#:$) '
%(!:#:$)
allows you to change the default prompt symbol from % to $ (which it seems you are wanting to do) and still keep # for root.
If you just want to keep the default zsh prompt symbol, use:
PS1='%n@%m %# '
Not sure why you have '[' in there. If you would like to use square brackets around the username and host:
PS1='[%n@%m] %(!:#:$) '
If you would like the current directory in your prompt, add %c
.
Also there's no need to use export.