From f8473714472ba8c59e4e0b3e3d95bf78f31871c3 Mon Sep 17 00:00:00 2001 From: Enze Chi Date: Thu, 2 Aug 2018 21:46:20 +1000 Subject: [PATCH] Avoid double semicolon in the PROMPT_COMMAND The direnv bash hook already add a semicolon to the PROMPT_COMMAND and this plugin will add another one if direnv is installed. This commit will check if the PROMPT_COMMAND ends with semicolon to avoid have double ones. --- plugins/available/osx.plugin.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/available/osx.plugin.bash b/plugins/available/osx.plugin.bash index 2dba0279..0e74ab8d 100644 --- a/plugins/available/osx.plugin.bash +++ b/plugins/available/osx.plugin.bash @@ -5,7 +5,7 @@ about-plugin 'osx-specific functions' if [ $(uname) = "Darwin" ]; then if type update_terminal_cwd > /dev/null 2>&1 ; then if ! [[ $PROMPT_COMMAND =~ (^|;)update_terminal_cwd($|;) ]] ; then - PROMPT_COMMAND="$PROMPT_COMMAND;update_terminal_cwd" + PROMPT_COMMAND="${PROMPT_COMMAND%;};update_terminal_cwd" declared="$(declare -p PROMPT_COMMAND)" [[ "$declared" =~ \ -[aAilrtu]*x[aAilrtu]*\ ]] 2>/dev/null [[ $? -eq 0 ]] && export PROMPT_COMMAND