Why does zsh list my prompt incorrectly on OS X?
I'm trying to figure out why zsh's prompt looks like this:

(in text form):
[]u[] at []h[] in []w[]$(__git_ps1) []$(git_diff)n[]($(date +'1:MikesMBP.local ')) []$[]
I'd like it to list my pwd and username normally like it does in bash before calling zsh. Here's my .zshrc:
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
setopt appendhistory autocd beep extendedglob nomatch notify
bindkey -v
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/Users/mike/.zshrc'
autoload -Uz compinit
compinit
# End of lines added by compinstall
This is just a standard config created when first starting zsh. I've tried both the built-in OS X zsh and homebrew's zsh and they produce the same error. Do you see something that would cause this?
shell osx zsh prompt
New contributor
PascLeRasc is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
I'm trying to figure out why zsh's prompt looks like this:

(in text form):
[]u[] at []h[] in []w[]$(__git_ps1) []$(git_diff)n[]($(date +'1:MikesMBP.local ')) []$[]
I'd like it to list my pwd and username normally like it does in bash before calling zsh. Here's my .zshrc:
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
setopt appendhistory autocd beep extendedglob nomatch notify
bindkey -v
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/Users/mike/.zshrc'
autoload -Uz compinit
compinit
# End of lines added by compinstall
This is just a standard config created when first starting zsh. I've tried both the built-in OS X zsh and homebrew's zsh and they produce the same error. Do you see something that would cause this?
shell osx zsh prompt
New contributor
PascLeRasc is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
I'm trying to figure out why zsh's prompt looks like this:

(in text form):
[]u[] at []h[] in []w[]$(__git_ps1) []$(git_diff)n[]($(date +'1:MikesMBP.local ')) []$[]
I'd like it to list my pwd and username normally like it does in bash before calling zsh. Here's my .zshrc:
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
setopt appendhistory autocd beep extendedglob nomatch notify
bindkey -v
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/Users/mike/.zshrc'
autoload -Uz compinit
compinit
# End of lines added by compinstall
This is just a standard config created when first starting zsh. I've tried both the built-in OS X zsh and homebrew's zsh and they produce the same error. Do you see something that would cause this?
shell osx zsh prompt
New contributor
PascLeRasc is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
I'm trying to figure out why zsh's prompt looks like this:

(in text form):
[]u[] at []h[] in []w[]$(__git_ps1) []$(git_diff)n[]($(date +'1:MikesMBP.local ')) []$[]
I'd like it to list my pwd and username normally like it does in bash before calling zsh. Here's my .zshrc:
# Lines configured by zsh-newuser-install
HISTFILE=~/.histfile
HISTSIZE=1000
SAVEHIST=1000
setopt appendhistory autocd beep extendedglob nomatch notify
bindkey -v
# End of lines configured by zsh-newuser-install
# The following lines were added by compinstall
zstyle :compinstall filename '/Users/mike/.zshrc'
autoload -Uz compinit
compinit
# End of lines added by compinstall
This is just a standard config created when first starting zsh. I've tried both the built-in OS X zsh and homebrew's zsh and they produce the same error. Do you see something that would cause this?
shell osx zsh prompt
shell osx zsh prompt
New contributor
PascLeRasc is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
PascLeRasc is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
edited 1 hour ago
Jeff Schaller
39.3k1054125
39.3k1054125
New contributor
PascLeRasc is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
asked 1 hour ago
PascLeRascPascLeRasc
1011
1011
New contributor
PascLeRasc is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
New contributor
PascLeRasc is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
PascLeRasc is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
bash uses [ and ] to mark parts of the prompt which are nonprinting.
zsh uses %{ and %} for the same purpose.
The xterm manual has a section which mentions this.
So if I start my terminal with zsh as the default shell it'll fix it?
– PascLeRasc
1 hour ago
no - see other answer: zsh is seeing thePS1which bash knows how to handle.
– Thomas Dickey
1 hour ago
add a comment |
You exported the variable PS1 in the previous shell so zsh inherits it and uses the variable to display your prompt. This is the reason why you should not export shell parameters like PS*, had PS1 not be exported zsh would've used its default prompt until you changed PS1 in your .zshrc or used the prompt system.
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
PascLeRasc is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f494326%2fwhy-does-zsh-list-my-prompt-incorrectly-on-os-x%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
bash uses [ and ] to mark parts of the prompt which are nonprinting.
zsh uses %{ and %} for the same purpose.
The xterm manual has a section which mentions this.
So if I start my terminal with zsh as the default shell it'll fix it?
– PascLeRasc
1 hour ago
no - see other answer: zsh is seeing thePS1which bash knows how to handle.
– Thomas Dickey
1 hour ago
add a comment |
bash uses [ and ] to mark parts of the prompt which are nonprinting.
zsh uses %{ and %} for the same purpose.
The xterm manual has a section which mentions this.
So if I start my terminal with zsh as the default shell it'll fix it?
– PascLeRasc
1 hour ago
no - see other answer: zsh is seeing thePS1which bash knows how to handle.
– Thomas Dickey
1 hour ago
add a comment |
bash uses [ and ] to mark parts of the prompt which are nonprinting.
zsh uses %{ and %} for the same purpose.
The xterm manual has a section which mentions this.
bash uses [ and ] to mark parts of the prompt which are nonprinting.
zsh uses %{ and %} for the same purpose.
The xterm manual has a section which mentions this.
answered 1 hour ago
Thomas DickeyThomas Dickey
52.2k594165
52.2k594165
So if I start my terminal with zsh as the default shell it'll fix it?
– PascLeRasc
1 hour ago
no - see other answer: zsh is seeing thePS1which bash knows how to handle.
– Thomas Dickey
1 hour ago
add a comment |
So if I start my terminal with zsh as the default shell it'll fix it?
– PascLeRasc
1 hour ago
no - see other answer: zsh is seeing thePS1which bash knows how to handle.
– Thomas Dickey
1 hour ago
So if I start my terminal with zsh as the default shell it'll fix it?
– PascLeRasc
1 hour ago
So if I start my terminal with zsh as the default shell it'll fix it?
– PascLeRasc
1 hour ago
no - see other answer: zsh is seeing the
PS1 which bash knows how to handle.– Thomas Dickey
1 hour ago
no - see other answer: zsh is seeing the
PS1 which bash knows how to handle.– Thomas Dickey
1 hour ago
add a comment |
You exported the variable PS1 in the previous shell so zsh inherits it and uses the variable to display your prompt. This is the reason why you should not export shell parameters like PS*, had PS1 not be exported zsh would've used its default prompt until you changed PS1 in your .zshrc or used the prompt system.
add a comment |
You exported the variable PS1 in the previous shell so zsh inherits it and uses the variable to display your prompt. This is the reason why you should not export shell parameters like PS*, had PS1 not be exported zsh would've used its default prompt until you changed PS1 in your .zshrc or used the prompt system.
add a comment |
You exported the variable PS1 in the previous shell so zsh inherits it and uses the variable to display your prompt. This is the reason why you should not export shell parameters like PS*, had PS1 not be exported zsh would've used its default prompt until you changed PS1 in your .zshrc or used the prompt system.
You exported the variable PS1 in the previous shell so zsh inherits it and uses the variable to display your prompt. This is the reason why you should not export shell parameters like PS*, had PS1 not be exported zsh would've used its default prompt until you changed PS1 in your .zshrc or used the prompt system.
answered 1 hour ago
lluallua
4,7091420
4,7091420
add a comment |
add a comment |
PascLeRasc is a new contributor. Be nice, and check out our Code of Conduct.
PascLeRasc is a new contributor. Be nice, and check out our Code of Conduct.
PascLeRasc is a new contributor. Be nice, and check out our Code of Conduct.
PascLeRasc is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f494326%2fwhy-does-zsh-list-my-prompt-incorrectly-on-os-x%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown