[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem with function cd in bash 4.0

From: Bernd Eggink
Subject: Re: Problem with function cd in bash 4.0
Date: Tue, 24 Feb 2009 10:07:41 +0100
User-agent: Thunderbird (X11/20081209)

Chet Ramey schrieb:
Bernd Eggink wrote:
I normally wrap the builtin cd into a function cd, which does some
additional things and then calls the builtin. Example:

   function cd
    local list=$(echo *.bui)
    # ...
        builtin cd "$1"

I have a PS1 like this:

   PS1="\\w \$ "

With bash 3, this worked well; cd-ing into a directory changed the
prompt immediately. With bash 4, however, the prompt keeps unchanged
after a call to cd and only gets adjusted after the _next_ command. I
noticed that this depends on a subshell being used in the function.
Without that, it behaves as before.

Is that a bug? I can get the intended behaviour by putting

   eval "PS1='$PS1'"

at the end of the function, but that's a rather ugly workaround.

Yep, it's a bug.  Try the attached patch; it works for me.

Works for me, too. Thanks!


Bernd Eggink

reply via email to

[Prev in Thread] Current Thread [Next in Thread]