Check for empty or whitespace PROMPT_COMMAND before appending preexec_invoke_cmd

pull/775/head
Eric Anders 2016-08-04 15:51:15 -05:00
parent 6060c87178
commit 3b56275ef6
No known key found for this signature in database
GPG Key ID: C862DC03A16F40DF
1 changed files with 5 additions and 1 deletions

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
}