@@ -55,6 +55,7 @@ bash_preexec_imported="defined"
55
55
56
56
# WARNING: This variable is no longer used and should not be relied upon.
57
57
# Use ${bash_preexec_imported} instead.
58
+ # shellcheck disable=SC2034
58
59
__bp_imported=" ${bash_preexec_imported} "
59
60
60
61
# Should be available to each precmd and preexec
@@ -177,7 +178,7 @@ __bp_precmd_invoke_cmd() {
177
178
# precmd functions. This is available for instance in zsh. We can simulate it in bash
178
179
# by setting the value here.
179
180
__bp_set_ret_value () {
180
- return " ${1:- } "
181
+ return ${1: + " $1 " }
181
182
}
182
183
183
184
__bp_in_prompt_command () {
@@ -268,7 +269,7 @@ __bp_preexec_invoke_exec() {
268
269
# Only execute each function if it actually exists.
269
270
# Test existence of function with: declare -[fF]
270
271
if type -t " $preexec_function " 1> /dev/null; then
271
- __bp_set_ret_value ${__bp_last_ret_value:- }
272
+ __bp_set_ret_value " ${__bp_last_ret_value:- } "
272
273
# Quote our function invocation to prevent issues with IFS
273
274
" $preexec_function " " $this_command "
274
275
preexec_function_ret_value=" $? "
@@ -325,8 +326,7 @@ __bp_install() {
325
326
local existing_prompt_command
326
327
# Remove setting our trap install string and sanitize the existing prompt command string
327
328
existing_prompt_command=" ${PROMPT_COMMAND:- } "
328
- # shellcheck disable=SC1087
329
- existing_prompt_command=" ${existing_prompt_command// $__bp_install_string [;$'\n']} " # Edge case of appending to PROMPT_COMMAND
329
+ existing_prompt_command=" ${existing_prompt_command// ${__bp_install_string} [;$'\n']} " # Edge case of appending to PROMPT_COMMAND
330
330
existing_prompt_command=" ${existing_prompt_command// $__bp_install_string } "
331
331
__bp_sanitize_string existing_prompt_command " $existing_prompt_command "
332
332
0 commit comments