--- a/bashline.c 2017-01-20 21:22:01.000000000 +0200 +++ b/bashline.c 2018-08-06 10:05:31.670533840 +0300 @@ -55,6 +55,7 @@ #include "shmbutil.h" #include "trap.h" #include "flags.h" +#include "externs.h" /* decode_prompt_string() */ #if defined (HAVE_MBSTR_H) && defined (HAVE_MBSCHR) # include /* mbschr */ @@ -4066,6 +4067,8 @@ #endif } +extern char *current_readline_prompt; + static int bash_execute_unix_command (count, key) int count; /* ignored */ @@ -4122,6 +4125,11 @@ save_parser_state (&ps); r = parse_and_execute (cmd, "bash_execute_unix_command", SEVAL_NOHIST|SEVAL_NOFREE); restore_parser_state (&ps); + + /* current dir may have changed, decode prompt again */ + FREE (current_readline_prompt); + current_readline_prompt = decode_prompt_string (current_prompt_string); + rl_expand_prompt (current_readline_prompt); v = find_variable ("READLINE_LINE"); l1 = v ? value_cell (v) : 0;