Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PROMPT



Oliver Grimm wrote:
> The /etc/zshrc file sources /etc/profile, which contains the following:
> 
> if test -z "$EMACS" ; then
>     if   [ -n "$ZSH_VERSION" ]; then
>         precmd ()
>         {
>             if test "$UID" = 0; then
>                 PS1="%m:`pwd -r` # "
>             else
>                 PS1="%n@%m:`pwd -r` > "
>             fi
>         }
>     fi
> fi
> 
> I wonder if this was intended by the designer of the profile ?

I can hardly believe it. The correct way of doing this, by the way, is

setopt promptsubst
PS1='%n@%m:`pwd -r`'

or if you insist on having the physical directory (the -r argument to pwd),
it might be better to have

setopt chaselinks
PS1='%n@%m:%/'

but using precmd() just to get the raw directory into the prompt is serious
overkill.

-- 
Peter Stephenson <pws@xxxxxxxxxxxxxxxxx>       Tel: +39 050 844536
WWW:  http://www.ifh.de/~pws/
Dipartimento di Fisica, Via Buonarroti 2, 56127 Pisa, Italy



Messages sorted by: Reverse Date, Date, Thread, Author