Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #257148

Re: Bookworm: dash shell globs don't recognise [^...] to negate a character class

From Vincent Lefevre <vincent@vinc17.net>
Newsgroups linux.debian.user
Subject Re: Bookworm: dash shell globs don't recognise [^...] to negate a character class
Date 2023-04-13 17:00 +0200
Message-ID <Gk6Ax-1LUg-1@gated-at.bofh.it> (permalink)
References <GjSQV-1DIB-15@gated-at.bofh.it> <GjTDj-1Edp-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 2023-04-12 21:07:59 -0400, Greg Wooledge wrote:
> On Thu, Apr 13, 2023 at 12:12:23AM +0000, David wrote:
> > $ echo [^0-9]*
> > 11 22           <------ new behaviour by dash
> 
> The [^chars] syntax is a negation in Basic and Extended Regular
> Expressions, and in bash's globs (it's a bash extension), but NOT in
> POSIX globs.
> 
> The correct negation syntax in POSIX sh globs is [!chars].

It seems that [^chars] has undefined behavior (various POSIX shells
behave differently: bash, ksh93 and yash regard ^ as a negation, but
not mksh). In short, for portability, this form should not be used
in shells.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)

Back to linux.debian.user | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Bookworm: dash shell globs don't recognise [^...] to negate a  character class David <bouncingcats@gmail.com> - 2023-04-13 02:20 +0200
  Re: Bookworm: dash shell globs don't recognise [^...] to negate a  character class Jude DaShiell <jdashiel@panix.com> - 2023-04-13 02:30 +0200
    Re: Bookworm: dash shell globs don't recognise [^...] to negate a  character class Jude DaShiell <jdashiel@panix.com> - 2023-04-13 02:40 +0200
  Re: Bookworm: dash shell globs don't recognise [^...] to negate a  character class Greg Wooledge <greg@wooledge.org> - 2023-04-13 03:10 +0200
    Re: Bookworm: dash shell globs don't recognise [^...] to negate a  character class Vincent Lefevre <vincent@vinc17.net> - 2023-04-13 17:00 +0200
    Re: Bookworm: dash shell globs don't recognise [^...] to negate a  character class Max Nikulin <manikulin@gmail.com> - 2023-04-14 04:10 +0200
      Re: Bookworm: dash shell globs don't recognise [^...] to negate a  character class Greg Wooledge <greg@wooledge.org> - 2023-04-14 04:40 +0200
        Re: Bookworm: dash shell globs don't recognise [^...] to negate a character class rhkramer@gmail.com - 2023-04-14 18:10 +0200
          Re: Bookworm: dash shell globs don't recognise [^...] to negate a  character class Greg Wooledge <greg@wooledge.org> - 2023-04-14 19:00 +0200
          Re: Bookworm: dash shell globs don't recognise [^...] to negate a  character class David Wright <deblis@lionunicorn.co.uk> - 2023-04-15 00:30 +0200
        Re: Bookworm: dash shell globs don't recognise [^...] to negate a  character class Max Nikulin <manikulin@gmail.com> - 2023-04-15 04:50 +0200
          Re: Bookworm: dash shell globs don't recognise [^...] to negate a  character class Greg Wooledge <greg@wooledge.org> - 2023-04-15 05:10 +0200
            Re: Bookworm: dash shell globs don't recognise [^...] to negate a  character class <tomas@tuxteam.de> - 2023-04-15 07:10 +0200
              Re: Bookworm: dash shell globs don't recognise [^...] to negate a  character class Max Nikulin <manikulin@gmail.com> - 2023-04-15 08:20 +0200
                Re: Bookworm: dash shell globs don't recognise [^...] to negate a  character class <tomas@tuxteam.de> - 2023-04-15 09:40 +0200
                Re: Bookworm: dash shell globs don't recognise [^...] to negate a  character class davidson <davidson@freevolt.org> - 2023-04-15 13:10 +0200
                Re: Bookworm: dash shell globs don't recognise [^...] to negate a  character class Greg Wooledge <greg@wooledge.org> - 2023-04-15 14:40 +0200
                Re: Bookworm: dash shell globs don't recognise [^...] to negate a  character class Max Nikulin <manikulin@gmail.com> - 2023-04-16 06:10 +0200
                Re: Bookworm: dash shell globs don't recognise [^...] to negate a  character class Vincent Lefevre <vincent@vinc17.net> - 2023-04-18 16:30 +0200
                Re: Bookworm: dash shell globs don't recognise [^...] to negate a  character class Greg Wooledge <greg@wooledge.org> - 2023-04-18 16:40 +0200
                Re: Bookworm: dash shell globs don't recognise [^...] to negate a  character class Max Nikulin <manikulin@gmail.com> - 2023-04-19 12:40 +0200
                Re: Bookworm: dash shell globs don't recognise [^...] to negate a  character class davidson <davidson@freevolt.org> - 2023-04-19 22:20 +0200
                Re: Bookworm: dash shell globs don't recognise [^...] to negate a  character class davidson <davidson@freevolt.org> - 2023-04-19 22:30 +0200
                Re: Bookworm: dash shell globs don't recognise [^...] to negate a  character class Max Nikulin <manikulin@gmail.com> - 2023-04-21 09:10 +0200

csiph-web