I found another (possibly better) way to fix this:
> On Apr 10, 2018, at 3:18 AM, Matt Coleman <[email protected]> wrote:
>
>> 1) What platform OS / version / sed version is this on?
> I'm experiencing this on macOS Sierra (10.12.6). The issue occurs with the
> OS's native sed, which is FreeBSD sed so the version number is kind of
> ambiguous.
>
> The error goes away if I set LANG=C or LC_ALL=C or change it to use GNU sed
> (installed via homebrew as gsed).
If I change it to use awk instead of sed, it works with mawk, gawk, and macOS
awk:
unset $(set | awk -F '=' '/^__gitcomp_builtin_[a-zA-Z0-9_][a-zA-Z0-9_]*=/
{print $1}') 2>/dev/null
I compared sed vs. awk on Linux and Mac and they all take about the same amount
of time to run (within 0.002ms).