On Monday 23 February 2009 23:02:56 Chet Ramey wrote:
> 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.

this introduces a bug of it's own though :/.  you can no longer use ctrl+c to 
escape from unbalanced quotes.

- type: echo '
- hit enter
- hit ctrl+c over and over
- bash still waits for the ' to be balanced
-mike


Reply via email to