[PATCH] Re-display prompt if directory changed in a bind -x command
From:
Bogdan Harjoc
Subject:
[PATCH] Re-display prompt if directory changed in a bind -x command
Date:
Mon, 6 Aug 2018 10:12:02 +0300
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