pawamoy / shell-history

Visualize your shell usage with Highcharts!
ISC License
112 stars 2 forks source link

Trap on DEBUG not removed with shellhistory disable #30

Closed pawamoy closed 5 years ago

pawamoy commented 5 years ago

It seems to be because trap - DEBUG is run inside of a function (_shellhistory_disable).

A quick fix for this is to use PROMPT_COMMAND to unset it instead:

new_prompt_command=${PROMPT_COMMAND//_shellhistory_after;}
PROMPT_COMMAND="trap '${trap:--}' DEBUG; PROMPT_COMMAND='${new_prompt_command}'"

Explanation: