Skip to content

Commit

Permalink
Don't export $PS1
Browse files Browse the repository at this point in the history
The `$PS1` variable does not need to be exported in order for `zsh` to
use its contents to set prompt options. `export`ing it has the negative
side-effect of polluting prompts in shells launched from `zsh`. The
`export`ing of `$PS1` is the cause of thoughtbot#270, where using `sudo su` to
become another user (launching a non-`zsh` shell) resulted in a
corrupted prompt.

Removing the `export` will allow `sh`/`bash`/`dash` and other shells to
be launched from `zsh` without inheriting its prompt settings.

Fix thoughtbot#270.
  • Loading branch information
geoffharcourt committed Nov 13, 2015
1 parent f074afe commit b3a3c2e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion zsh/configs/prompt.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ git_prompt_info() {
fi
}
setopt promptsubst
export PS1='${SSH_CONNECTION+"%{$fg_bold[green]%}%n@%m:"}%{$fg_bold[blue]%}%c%{$reset_color%}$(git_prompt_info) %# '
PS1='${SSH_CONNECTION+"%{$fg_bold[green]%}%n@%m:"}%{$fg_bold[blue]%}%c%{$reset_color%}$(git_prompt_info) %# '

0 comments on commit b3a3c2e

Please sign in to comment.