[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: help with pattern matching needed
From: |
Christoph Anton Mitterer |
Subject: |
Re: help with pattern matching needed |
Date: |
Wed, 12 Jan 2022 06:33:02 +0100 |
User-agent: |
Evolution 3.42.2-1 |
Hey again.
I just noted that bash and klibc sh behave differently from dash and
busybox sh...
$ cat circumflex-test
case "$1" in
(['^.a'])
echo match
;;
(*)
echo else
esac
$ cat exclamation-test
case "$1" in
(['!.a'])
echo match
;;
(*)
echo else
esac
$ cat run-circumflex
echo dash:
dash circumflex-test ^
dash circumflex-test .
dash circumflex-test a
echo busybox-sh:
busybox sh circumflex-test ^
busybox sh circumflex-test .
busybox sh circumflex-test a
echo bash:
bash circumflex-test ^
bash circumflex-test .
bash circumflex-test a
echo klibc-sh:
/usr/lib/klibc/bin/sh circumflex-test ^
/usr/lib/klibc/bin/sh circumflex-test .
/usr/lib/klibc/bin/sh circumflex-test a
$ cat run-exlamation
echo dash:
dash exclamation-test '!'
dash exclamation-test .
dash exclamation-test a
echo busybox-sh:
busybox sh exclamation-test '!'
busybox sh exclamation-test .
busybox sh exclamation-test a
echo bash:
bash exclamation-test '!'
bash exclamation-test .
bash exclamation-test a
echo klibc-sh:
/usr/lib/klibc/bin/sh exclamation-test '!'
/usr/lib/klibc/bin/sh exclamation-test .
/usr/lib/klibc/bin/sh exclamation-test a
When run:
$ sh run-circumflex | paste - - - - | column -t
dash: match else else
busybox-sh: match else else
bash: match match match
klibc-sh: match match match
$
^ . a
$ sh run-exlamation | paste - - - - | column -t
dash: match match match
busybox-sh: match match match
bash: match match match
klibc-sh: match match match
$
! . a
Does anyone have any explanation for this (other than it being a bug in
dash/busybox-sh[0])?
Thanks,
Chris.
[0] And yes I know this list is about bash, but since here are so
knowledgable experts I thought I could dare to ask. O:-)
- Re: help with pattern matching needed, (continued)
- Re: help with pattern matching needed, Christoph Anton Mitterer, 2022/01/07
- Re: help with pattern matching needed, Chet Ramey, 2022/01/08
- Re: help with pattern matching needed, Christoph Anton Mitterer, 2022/01/10
- Re: help with pattern matching needed, Christoph Anton Mitterer, 2022/01/11
- Re: help with pattern matching needed, Lawrence Velázquez, 2022/01/11
- Re: help with pattern matching needed, Christoph Anton Mitterer, 2022/01/11
- Re: help with pattern matching needed,
Christoph Anton Mitterer <=
- Re: help with pattern matching needed, Christoph Anton Mitterer, 2022/01/12
- Re: help with pattern matching needed, Lawrence Velázquez, 2022/01/12
- Re: help with pattern matching needed, Christoph Anton Mitterer, 2022/01/12
- Re: help with pattern matching needed, Greg Wooledge, 2022/01/12
- Re: help with pattern matching needed, Christoph Anton Mitterer, 2022/01/12
- Re: help with pattern matching needed, Greg Wooledge, 2022/01/12
- Re: help with pattern matching needed, Chet Ramey, 2022/01/12
- Re: help with pattern matching needed, Kerin Millar, 2022/01/12