On Thu, 6 Jan 2011 23:35:32 +0100
Ezequiel Garzsn <[email protected]> wrote:

> On Thu, Jan 6, 2011 at 11:18 PM, xSAPPYx <[email protected]> wrote:
> > I think ksh(1) man page has the info, or maybe it is intro(8)
> >
> > Try this:
> >  echo "export ENV=$HOME/.kshrc" >> ~/.profile
> >  echo ". /etc/ksh.kshrc" >> ~/.kshrc
>
> Yes, in that case the new PS1 value is set by ~/.kshrc, which
> overrides whatever I did in .profile, but that still leaves me
> wondering as to why this happens: what other file or setting is being
> read that changes PS1 back to its default setting?
>

bin/ksh/main.c:
        safe_prompt = ksheuid ? "$ " : "# ";
        {
                struct tbl *vp = global("PS1");

                /* Set PS1 if it isn't set, or we are root and prompt doesn't
                 * contain a # or \$ (only in ksh mode).
                 */
                if (!(vp->flag & ISSET) ||
                    (!ksheuid && !strchr(str_val(vp), '#') &&
                    (Flag(FSH) || !strstr(str_val(vp), "\\$"))))
                        /* setstr can't fail here */
                        setstr(vp, safe_prompt, KSH_RETURN_ERROR);
        }

Reply via email to