I have the following code in my bashrc to get the execution time of the last command from https://stackoverflow.com/a/1862762function timer_start {  timer=${timer:-$SECONDS}}function timer_stop {  timer_show=$(($SECONDS - $timer))  unset timer}trap 'timer_start' DEBUGPROMPT_COMMAND=timer_stopPS1='[last: ${timer_show}s][\w]$ 'but when I run echo $_ it shows timer_start instead of the last commands parameter.How can I change this to preserve the $_ variable?
prevent trap from altering underscore variable $_
bash;shell;parameter;trap;variable
You could do:trap '__=$_; timer_start; : $__' DEBUG