From f4b5dd1d61d8fac28959b7eaa229c2a707bffccb Mon Sep 17 00:00:00 2001 From: Koichi Murase Date: Wed, 17 Jul 2024 13:28:16 +0900 Subject: [PATCH] Work around Bash 3.0 syntax --- mcfly.bash | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mcfly.bash b/mcfly.bash index 31d2e48..87d26c2 100644 --- a/mcfly.bash +++ b/mcfly.bash @@ -75,7 +75,10 @@ function mcfly_initialize { # conflicts with other frameworks. if [[ " ${PROMPT_COMMAND[*]-} " != *" $command "* ]]; then PROMPT_COMMAND[0]=${PROMPT_COMMAND[0]:-} - PROMPT_COMMAND+=("$command") + # Note: We here use eval to avoid syntax error in Bash < 3.1. We drop + # the support for Bash < 3.0, but this is still needed to avoid parse + # error before the Bash version check is performed. + eval 'PROMPT_COMMAND+=("$command")' fi elif [[ -z ${PROMPT_COMMAND-} ]]; then PROMPT_COMMAND="$command"