From 33300fc9e4e8aa4bb0cc8b67d03d12a20155f793 Mon Sep 17 00:00:00 2001 From: Antti Boman Date: Wed, 18 Jul 2018 15:34:35 +0300 Subject: [PATCH] If PROMPT_COMMAND is not empty, prepend to it instead of replacing it --- 2016/persistent-history/add-persistent-history.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/2016/persistent-history/add-persistent-history.sh b/2016/persistent-history/add-persistent-history.sh index 007503d8..d78bf49b 100644 --- a/2016/persistent-history/add-persistent-history.sh +++ b/2016/persistent-history/add-persistent-history.sh @@ -33,4 +33,9 @@ run_on_prompt_command() log_bash_persistent_history } -PROMPT_COMMAND="run_on_prompt_command" +if [ "$PROMPT_COMMAND" = "" ] +then + PROMPT_COMMAND="run_on_prompt_command" +else + PROMPT_COMMAND="run_on_prompt_command; ""$PROMPT_COMMAND" +fi