Skip to content

Commit

Permalink
agnoster: use %n instead of $USER to fix quoting
Browse files Browse the repository at this point in the history
Fixes ohmyzsh#7268

With `$USER`, we'd need to quote it in case special characters like `\` are present in
the $USER value, like if the user is part of an AD domain.

With `%n` the quoting is done automatically by zsh.
See http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html#Login-information
  • Loading branch information
mcornella authored Oct 17, 2018
1 parent ea7b886 commit 2fce9a4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion themes/agnoster.zsh-theme
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ prompt_end() {
# Context: user@hostname (who am I and where am I)
prompt_context() {
if [[ "$USER" != "$DEFAULT_USER" || -n "$SSH_CLIENT" ]]; then
prompt_segment black default "%(!.%{%F{yellow}%}.)$USER@%m"
prompt_segment black default "%(!.%{%F{yellow}%}.)%n@%m"
fi
}

Expand Down

0 comments on commit 2fce9a4

Please sign in to comment.