Check for empty or whitespace PROMPT_COMMAND before appending preexec_invoke_cmd

This commit is contained in:
Eric Anders
2016-08-04 15:51:15 -05:00
parent 6060c87178
commit 3b56275ef6

View File

@@ -122,7 +122,11 @@ function preexec_install () {
shopt -s extdebug > /dev/null 2>&1
# Finally, install the actual traps.
PROMPT_COMMAND="${PROMPT_COMMAND};preexec_invoke_cmd"
if [[ ! -z "${PROMPT_COMMAND// }" ]]; then
PROMPT_COMMAND="${PROMPT_COMMAND};preexec_invoke_cmd"
else
PROMPT_COMMAND="preexec_invoke_cmd"
fi
trap 'preexec_invoke_exec' DEBUG
}