bug-bash
[Top][All Lists]
Advanced

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

Re: Problem with function cd in bash 4.0


From: Mike Frysinger
Subject: Re: Problem with function cd in bash 4.0
Date: Wed, 25 Feb 2009 14:00:10 -0500
User-agent: KMail/1.11.0 (Linux/2.6.28; KDE/4.2.0; x86_64; ; )

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

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