Re: cd won't change the prompt if the command is typed in the vi editor
From:
Chet Ramey
Subject:
Re: cd won't change the prompt if the command is typed in the vi editor (vi mode).
Date:
Mon, 13 May 2013 09:28:15 -0400
User-agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:17.0) Gecko/20130328 Thunderbird/17.0.5
On 5/12/13 6:50 PM, Peng Yu wrote:
> Hi,
>
> I have vi mode set.
>
> set -o vi.
>
> Then I type v to enter the vi editor. In the vi editor, I type 'cd
> /tmp'. Then, I get the following screen output. Notice that the prompt
> does not change immediately after the cd command. Could anybody
> reproduce this behavior? Thanks.
>
> ~$
> cd /tmp
> ~$ echo $PWD
> /tmp
> /tmp$
This all happens within the context of the same call to readline(). PS1
isn't reevaluated until before the next readline() call.
>From the bash/readline perspective, this is just an editing command that
causes other shell commands to be executed. There's no equivalent of
`accept-line' there that would return control to the parser.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/