Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14441

[PATCH] Re-display prompt if directory changed in a bind -x command

From Bogdan Harjoc <harjoc@gmail.com>
Newsgroups gnu.bash.bug
Subject [PATCH] Re-display prompt if directory changed in a bind -x command
Date 2018-08-06 10:12 +0300
Message-ID <mailman.4730.1533543201.1292.bug-bash@gnu.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Using bind -x to call cd or source a script that changes the directory
will not update the prompt to show the new directory after the script
finished:

user@host:~$ bind -x '"\C-t": "echo test;cd /"'

# I press Ctrl-T
test
user@host:~$

Prompt still shows ~ as the pwd. Once I press Return or Ctrl-L the
prompt shows root as the pwd.

Updating the prompt is useful when using the mc-wrapper.sh script for
Midnight Commander that changes the bash pwd to the last mc directory
when mc exits. There is a similar wrapper for vim for example.

Attached patch decodes the prompt string again after running the
command passed to bind -x.

Regards,
Bogdan

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

[PATCH] Re-display prompt if directory changed in a bind -x command Bogdan Harjoc <harjoc@gmail.com> - 2018-08-06 10:12 +0300

csiph-web