svn commit: r227366 - in head/etc: . rc.d

Jilles Tjoelker jilles at stack.nl
Wed Nov 9 21:31:29 UTC 2011


On Wed, Nov 09, 2011 at 01:49:16AM +0000, Alexey Dokuchaev wrote:
> On Tue, Nov 08, 2011 at 11:02:32PM +0000, Jilles Tjoelker wrote:
> > Author: jilles
> > Date: Tue Nov  8 23:02:32 2011
> > New Revision: 227366
> > URL: http://svn.freebsd.org/changeset/base/227366

> > Log:
> >   rc.d: Eliminate some unnecessary non-POSIX constructs:

> >    * ^ in character class

> > -			for file in ${dir}/[^0-9]*.sh; do
> > +			for file in ${dir}/[!0-9]*.sh; do

> I don't have my copy of POSIX handy, but looking at SUSv2, circumflex `^' is
> documented as non-matching list expression specifier, while `!' is not.

> I am reading it wrong?

Shell patterns are different from regular expressions.

In SUSv4, XCU 2.13 Pattern Matching Notation describes shell patterns.
In particular, the role of the '^' to negate a bracket expression is
instead fulfilled by '!'; a '^' directly after the '[' produces
unspecified results (so that the common RE-like behaviour is allowed).
Historically, this is because the Bourne shell interprets '^' as a
synonym for '|' (pipe) and therefore it cannot occur in a pattern
unquoted.

-- 
Jilles Tjoelker


More information about the svn-src-all mailing list