On 2022-12-07, anonymous <[email protected]> wrote:
[...]
> On an elderly Mac with PPC Mac OS X 10.4.11, Tiger, this was reported:
>
> expr: brackets ([ ]) not balanced
>
> It comes from this line
>
> 76 year=`expr "$scriptversion" : '\([^-]*\)'`
>
> On two more up-to-date intel Macs expr worked correctly. I can make another
> test on PPC Mac OS X 10.5.8, Leopard.
FWIW this specific problem with Mac OS expr, as well as a possible
workaround, is discussed in the portable shell programming section
of the Autoconf manual[1]:
On Mac OS X 10.4, expr mishandles the pattern ‘[^-]’ in some cases.
For example, the command
expr Xpowerpc-apple-darwin8.1.0 : 'X[^-]*-[^-]*-\(.*\)'
outputs ‘apple-darwin8.1.0’ rather than the correct ‘darwin8.1.0’.
This particular case can be worked around by substituting ‘[^--]’
for ‘[^-]’.
[1]
https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.71/autoconf.html#index-expr-1
Cheers,
Nick