From: Andreas Schwab Date: Sun, 20 Sep 2020 16:03:24 GMT Subject: Re: [PATCH 2/4] builtin/rev-parse: learn --null-oid Message-ID: <87h7rsl9kj.fsf@igel.home> In-Reply-To: <20200918212609.GC67496@camp.crustytoothpaste.net> On Sep 18 2020, brian m. carlson wrote: > What I typically do when I write shell scripts, and which may obviate > the need for this patch is turn this: > > [ "$oid" = 0000000000000000000000000000000000000000 ] > > into this: > > echo "$oid" | grep -qsE '^0+$' > > This is slightly less efficient, but it's also backwards compatible > with older Git version assuming you have a POSIX grep. You can also use case $oid in *[1-9a-f]*) ... ;; *) ... ;; esac which doesn't need an external process. Andreas. -- Andreas Schwab, schwab@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."