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


Groups > gnu.bash.bug > #14441 > unrolled thread

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

Started byBogdan Harjoc <harjoc@gmail.com>
First post2018-08-06 10:12 +0300
Last post2018-08-06 10:12 +0300
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug


Contents

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

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

FromBogdan Harjoc <harjoc@gmail.com>
Date2018-08-06 10:12 +0300
Subject[PATCH] Re-display prompt if directory changed in a bind -x command
Message-ID<mailman.4730.1533543201.1292.bug-bash@gnu.org>

[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

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web