Re: [PATCH 1/2] t8005: avoid grep on non-ASCII data
- From
Eric Sunshine <sunshine@sunshineco.com>
- Date
- Feb 21, 2016, 23:50 UTC
- Message-ID
- <CAPig+cQvuc+Gn1jsnYr0_wMe+fggtHyJPXx4dV=h5sMGWpGRuQ@mail.gmail.com>
- In-Reply-To
- <20160221234135.GA14382@river.lan>
On Sun, Feb 21, 2016 at 6:41 PM, John Keeping <john@keeping.me.uk> wrote:
Show 13 quoted lines
> On Sun, Feb 21, 2016 at 06:19:14PM -0500, Jeff King wrote: >> On Sun, Feb 21, 2016 at 04:01:27PM -0500, Eric Sunshine wrote: >> > These tests all crash and burn with BSD sed (including Mac OS X) since >> > you're not restricting yourself to BRE (basic regular expressions). >> > You _could_ request extended regular expressions, which do work on >> > those platforms, as well as with GNU sed: >> > >> > sed -nEe "/^(author|summary) /p" ... >> >> At that point, I think we may as well use grep, because obscure >> platforms are probably broken either way. > > Also GNU sed doesn't understand "-E", it uses "-r" for --regexp-extended.
It actually does recognize -E in all the versions I've tested, however, apparently it's undocumented (thus probably should be avoided).
Show 6 quoted lines
> My original sed version was: > > sed -ne "/^author /p" -e "/^summary /p" > > which I think will work on all platforms (we already use it in > t0000-basic.sh) but then I decided to be too clever :-(
The unclever version seems fine.