Exporting $PS1.

Ag. Hatzimanikas a.hatzim at gmail.com
Sun Mar 11 12:50:24 PDT 2007

I came across from a post by Bart Schaefer, one of the lead zsh developers.
He clearly mentions that exporting the PS1 variable it doesn't make
sense in modern shells.

Bart Schaefer wrote:

> The use of "export PS1" is sensible in the old Bourne shell and in a
> strictly POSIX shell, because there is no file that is read by every
> interactive shell (only ~/.profile read by login shells).  It doesn't
> make sense in bash or zsh, because ~/.*shrc can set it and the various
> replacements (like zsh's %m and bash's \h for the machine name) are not
> compatible anyway, if you happen to start up some other shell.

I am using zsh as my login shell and I made a small experiment.

a) Removed ~/.bashrc
b) Export the PS1 in ~/.zshrc.


a) Removed ~/.bashrc
b) Assigned the PS1 in ~/.zshrc without exporting the variable.

bash-3.1$ echo $PS1

Exporting the PS1 variable is a bad idea.

More information about the blfs-dev mailing list