Skip to content

Commit 11aba65

Browse files
committed
Improved the substitution pattern
The history number is printed as "%5d" so we need to handle all possible columns. declare -a lines=( "10000 history 1" " 1000 history 1" " 1 history 1" " 1000* history 1" " 1000 history 1" ) for line in "${lines[@]}"; do echo "${line#*[[:digit:]][* ] }" done
1 parent c853a7e commit 11aba65

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

bash-preexec.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ __bp_preexec_invoke_exec() {
251251

252252
local this_command
253253
this_command=$(LC_ALL=C HISTTIMEFORMAT='' builtin history 1)
254-
this_command="${this_command# *[[:digit:]]*[* ] }"
254+
this_command="${this_command#*[[:digit:]][* ] }"
255255

256256
# Sanity check to make sure we have something to invoke our function with.
257257
if [[ -z "$this_command" ]]; then

0 commit comments

Comments
 (0)