Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #15405
| From | Allodoxaphobia <trepidation@example.net> |
|---|---|
| Newsgroups | gnu.bash.bug |
| Subject | Regular Expression matching operation =~ |
| Date | 2019-09-22 21:44 +0000 |
| Message-ID | <mailman.826.1569200533.2190.bug-bash@gnu.org> (permalink) |
| References | <slrnqofqq2.43b.trepidation@vps.jonz.net> |
In moving a bash ver. 4.3.48 (Ubuntu) program to a bash ver. 5.0.11
(FreeBSD) environment I encountered either a bug, a quirk, or
an undocumented feature.
I was using a null regexp as a "match for anything" case when an
optional command line parameter (a test pattern) was omitted.
I boiled down what I was experiencing to
$ bash -version
GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)
$ [[ "String" =~ "ring" ]] ; echo $?
0
$ [[ "String" =~ "" ]] ; echo $?
0
$
$ bash -version
GNU bash, version 5.0.11(0)-release (amd64-portbld-freebsd12.0)
$ [[ "String" =~ "ring" ]] ; echo $?
0
$ [[ "String" =~ "" ]] ; echo $?
2
$
A null regexp works Just Fine in both the Ubuntu and FreeBSD
environments. E.g.:
$ grep "" /etc/shells
Jonesy
--
Marvin L Jones | Marvin | W3DHJ.net | linux
38.238N 104.547W | @ jonz.net | Jonesy | FreeBSD
* Killfiling google & XXXXbanter.com: jonz.net/ng.htm
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
Regular Expression matching operation =~ Allodoxaphobia <trepidation@example.net> - 2019-09-22 21:44 +0000
csiph-web