Skip to content

Commit

Permalink
.bash_prompt: Avoid double-escaping ANSI codes
Browse files Browse the repository at this point in the history
  • Loading branch information
stefancrain authored and mathiasbynens committed Jun 17, 2014
1 parent ab3e3f6 commit 3ec5769
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions .bash_prompt
Expand Up @@ -91,30 +91,30 @@ fi;

# Highlight the user name when logged in as root.
if [[ "${USER}" == "root" ]]; then
userStyle="\[${red}\]";
userStyle="${red}";
else
userStyle="\[${orange}\]";
userStyle="${orange}";
fi;

# Highlight the hostname when connected via SSH.
if [[ "${SSH_TTY}" ]]; then
hostStyle="\[${bold}${red}\]";
hostStyle="${bold}${red}";
else
hostStyle="\[${yellow}\]";
hostStyle="${yellow}";
fi;

# Set the terminal title to the current working directory.
PS1="\[\033]0;\w\007\]";
PS1+="\[${bold}\]\n"; # newline
PS1+="\[${userStyle}\]\u"; # username
PS1+="\[${white}\] at ";
PS1+="\[${hostStyle}\]\h"; # host
PS1+="\[${white}\] in ";
PS1+="\[${green}\]\w"; # working directory
PS1="\033]0;\w\007";
PS1+="${bold}\n"; # newline
PS1+="${userStyle}\u"; # username
PS1+="${white} at ";
PS1+="${hostStyle}\h"; # host
PS1+="${white} in ";
PS1+="${green}\w"; # working directory
PS1+="\$(prompt_git \"${white} on ${violet}\")"; # Git repository details
PS1+="\n";
PS1+="\[${white}\]\$ \[${reset}\]"; # `$` (and reset color)
PS1+="${white}\$ ${reset}"; # `$` (and reset color)
export PS1;

PS2="\[${yellow}\]→ \[${reset}\]";
PS2="${yellow}${reset}";
export PS2;

0 comments on commit 3ec5769

Please sign in to comment.