On Wed, Jan 12, 2022, at 12:33 AM, Christoph Anton Mitterer wrote:
> I just noted that bash and klibc sh behave differently from dash and
> busybox sh...
>
> [...]
>
> Does anyone have any explanation for this (other than it being a bug in
> dash/busybox-sh[0])?
I cannot reproduce your dash results on macOS.
% port installed dash
The following ports are currently installed:
dash @0.5.11.3_0 (active)
% cat example.sh
for arg
do
case $arg in
['^.a']) printf '%s matched\n' "$arg" ;;
*) printf '%s did not match\n' "$arg" ;;
esac
done
% dash example.sh '^' . a
^ matched
. matched
a matched
This makes me suspect a bug somewhere, but it's hard to say much
of anything without more details about your shells, operating
systems, libc implementations, etc. It might be more fruitful to
ask the dash and busybox projects.
http://gondor.apana.org.au/~herbert/dash/https://www.busybox.net/lists.html
--
vq