fancy-linux-prompt icon indicating copy to clipboard operation
fancy-linux-prompt copied to clipboard

grep: warning: stray \ before d

Open tpetazzoni opened this issue 1 year ago • 3 comments

When I enter a number of Git repositories, I see:

grep: warning: stray \ before d
grep: warning: stray \ before d
grep: warning: stray \ before d
grep: warning: stray \ before d

before the prompt. It looks like:

        # how many commits local branch is ahead/behind of remote?
        stats="$(git status --porcelain --branch | grep '^##' | grep -o '\[.\+\]$')"
        aheadN="$(echo "$stats" | grep -o 'ahead \d\+' | grep -o '\d\+')"
        behindN="$(echo "$stats" | grep -o 'behind \d\+' | grep -o '\d\+')"

is not working as expected.

tpetazzoni avatar Oct 23 '24 14:10 tpetazzoni

Solved by using [[:digit:]] instead of \d

tpetazzoni avatar Oct 23 '24 15:10 tpetazzoni

Hopefully @pombadev will review, accept, and merge this fix.

dglinder avatar Jan 26 '25 02:01 dglinder

Hey @pombadev, what are your thoughts on this fix?

dglinder avatar May 15 '25 02:05 dglinder