Closed steinarvk closed 5 years ago
I'm no regex-pro, but what about:
h1=$(history -s foo$'\n'bar$'\n'lich; HISTTIMEFORMAT= history 1);
<<< "$h1" sed '1 s/^ *[0-9]\{1,\}[\* ] //';
<<< "$h1" sed '1 s/^ *[0-9]*[\* ] //';
@steinarvk thanks for reporting! Can one of you guys submit the PR?
I went with 1 s/^ *[0-9]\+[* ] //
in http://hg.mwdiamond.com/prompt.gem/commits/f1f67721 - the only difference between it and the variant in 1c9db27 is the \
-escaped +
symbol. I should have called out the risk of -E
in the PR but I didn't want to be a stickler :) I can send this change if we want.
@dimo414 that'd be awesome, please do! :pray:
This is an issue introduced with my earlier commit 1c9db27 . It uses the -E flag for sed (--regexp-extended), but this is not supported by every version of sed. Specifically I've observed it to fail on GNU sed 4.1.3.
It's probably better to use a variant of d630's suggestion from #79 .