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

2023-04-21 Thread Max Nikulin
On 20/04/2023 03:18, davidson wrote: On Wed, 19 Apr 2023 Max Nikulin wrote: On 18/04/2023 21:19, Vincent Lefevre wrote: BTW, history expansion can be very useful, but IMHO, this should have been interactive and triggered by control characters or escape sequences, not by "normal" characters.

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

2023-04-19 Thread davidson
On Wed, 19 Apr 2023 davidson wrote: On Wed, 19 Apr 2023 Max Nikulin wrote: On 18/04/2023 21:19, Vincent Lefevre wrote: BTW, history expansion can be very useful, but IMHO, this should have been interactive and triggered by control characters or escape sequences, not by "normal" characters.

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

2023-04-19 Thread davidson
On Wed, 19 Apr 2023 Max Nikulin wrote: On 18/04/2023 21:19, Vincent Lefevre wrote: BTW, history expansion can be very useful, but IMHO, this should have been interactive and triggered by control characters or escape sequences, not by "normal" characters. It would be great. Unfortunately

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

2023-04-19 Thread Max Nikulin
On 18/04/2023 21:19, Vincent Lefevre wrote: BTW, history expansion can be very useful, but IMHO, this should have been interactive and triggered by control characters or escape sequences, not by "normal" characters. It would be great. Unfortunately disabling histexpand option in bash blocks

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

2023-04-18 Thread Greg Wooledge
On Tue, Apr 18, 2023 at 04:19:47PM +0200, Vincent Lefevre wrote: > BTW, history expansion can be very useful, but IMHO, this should > have been interactive and triggered by control characters or > escape sequences, not by "normal" characters. History expansion originated in csh, and was

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

2023-04-18 Thread Vincent Lefevre
On 2023-04-16 11:04:09 +0700, Max Nikulin wrote: > On 15/04/2023 19:37, Greg Wooledge wrote: > > On Sat, Apr 15, 2023 at 11:02:12AM +, davidson wrote: > > > On Sat, 15 Apr 2023 Max Nikulin wrote: > > > > The problem is to prevent history expansion while keeping pattern > > > > matching (glob)

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

2023-04-15 Thread Max Nikulin
On 15/04/2023 19:37, Greg Wooledge wrote: On Sat, Apr 15, 2023 at 11:02:12AM +, davidson wrote: On Sat, 15 Apr 2023 Max Nikulin wrote: The problem is to prevent history expansion while keeping pattern matching (glob) active. du -ks -- .[!.]* | sort -n | tail Are there versions of

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

2023-04-15 Thread Greg Wooledge
On Sat, Apr 15, 2023 at 11:02:12AM +, davidson wrote: > On Sat, 15 Apr 2023 Max Nikulin wrote: > > The problem is to prevent history expansion while keeping pattern > > matching (glob) active. > > > > du -ks -- .[!.]* | sort -n | tail > > Are there versions of bash that exhibit history

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

2023-04-15 Thread davidson
On Sat, 15 Apr 2023 Max Nikulin wrote: On 15/04/2023 12:02, to...@tuxteam.de wrote: On Fri, Apr 14, 2023 at 11:02:03PM -0400, Greg Wooledge wrote: On Sat, Apr 15, 2023 at 09:44:03AM +0700, Max Nikulin wrote: As to [^c] vs. [!c], unfortunately the latter can not be always used as portable

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

2023-04-15 Thread tomas
On Sat, Apr 15, 2023 at 01:14:53PM +0700, Max Nikulin wrote: > On 15/04/2023 12:02, to...@tuxteam.de wrote: > > On Fri, Apr 14, 2023 at 11:02:03PM -0400, Greg Wooledge wrote: > > > On Sat, Apr 15, 2023 at 09:44:03AM +0700, Max Nikulin wrote: > > > > As to [^c] vs. [!c], unfortunately the latter

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

2023-04-15 Thread Max Nikulin
On 15/04/2023 12:02, to...@tuxteam.de wrote: On Fri, Apr 14, 2023 at 11:02:03PM -0400, Greg Wooledge wrote: On Sat, Apr 15, 2023 at 09:44:03AM +0700, Max Nikulin wrote: As to [^c] vs. [!c], unfortunately the latter can not be always used as portable variant. It is treated as history expansion

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

2023-04-14 Thread tomas
On Fri, Apr 14, 2023 at 11:02:03PM -0400, Greg Wooledge wrote: > On Sat, Apr 15, 2023 at 09:44:03AM +0700, Max Nikulin wrote: > > As to [^c] vs. [!c], unfortunately the latter can not be always used as > > portable variant. It is treated as history expansion in the case of > > interactive bash

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

2023-04-14 Thread Greg Wooledge
On Sat, Apr 15, 2023 at 09:44:03AM +0700, Max Nikulin wrote: > As to [^c] vs. [!c], unfortunately the latter can not be always used as > portable variant. It is treated as history expansion in the case of > interactive bash session. Ugh. That abomination. I've had history expansion disabled for

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

2023-04-14 Thread Max Nikulin
On 14/04/2023 09:36, Greg Wooledge wrote: On Fri, Apr 14, 2023 at 09:08:08AM +0700, Max Nikulin wrote: https://www.shellcheck.net/wiki/SC3026 Help by adding links to BashFAQ, StackOverflow, man pages, POSIX, etc Well, it's not clear how to actually add such a link. I guess you're supposed to

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

2023-04-14 Thread David Wright
On Fri 14 Apr 2023 at 12:01:39 (-0400), rhkra...@gmail.com wrote: > On Thursday, April 13, 2023 10:36:08 PM Greg Wooledge wrote: > > Anyway, here's the POSIX documentation section: > > > > https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#t > > ag_18_13 > > > > And the

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

2023-04-14 Thread Greg Wooledge
On Fri, Apr 14, 2023 at 12:01:39PM -0400, rhkra...@gmail.com wrote: > On Thursday, April 13, 2023 10:36:08 PM Greg Wooledge wrote: > > [ If an open bracket introduces a bracket expression as in XBD RE > > Bracket Expression, except that the character > > ( '!' ) shall replace the

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

2023-04-14 Thread rhkramer
On Thursday, April 13, 2023 10:36:08 PM Greg Wooledge wrote: > Anyway, here's the POSIX documentation section: > > https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#t > ag_18_13 > > And the relevant piece of text: > > [ If an open bracket introduces a bracket

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

2023-04-13 Thread Greg Wooledge
On Fri, Apr 14, 2023 at 09:08:08AM +0700, Max Nikulin wrote: > On 13/04/2023 08:07, Greg Wooledge wrote: > > On Thu, Apr 13, 2023 at 12:12:23AM +, David wrote: > > > $ echo [^0-9]* > > > 11 22 <-- new behaviour by dash > [...] > > The correct negation syntax in POSIX sh globs is

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

2023-04-13 Thread Max Nikulin
On 13/04/2023 08:07, Greg Wooledge wrote: On Thu, Apr 13, 2023 at 12:12:23AM +, David wrote: $ echo [^0-9]* 11 22 <-- new behaviour by dash [...] The correct negation syntax in POSIX sh globs is [!chars]. The shellcheck utility gives this suggestion as well. Their wiki

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

2023-04-13 Thread Vincent Lefevre
On 2023-04-12 21:07:59 -0400, Greg Wooledge wrote: > On Thu, Apr 13, 2023 at 12:12:23AM +, 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

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

2023-04-12 Thread Greg Wooledge
On Thu, Apr 13, 2023 at 12:12:23AM +, 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

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

2023-04-12 Thread Jude DaShiell
Something else I've noticed with bash. Those work when run in mate-terminal but not in console for some strange reason. -- Jude "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." Ed Howdershelt 1940. On Wed, 12 Apr 2023, Jude

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

2023-04-12 Thread Jude DaShiell
When I write bash scripts and I've done this for several debian versions I use: #!/usr/bin/env bash That has worked in the past. -- Jude "There are four boxes to be used in defense of liberty: soap, ballot, jury, and ammo. Please use in that order." Ed Howdershelt 1940. On Thu, 13 Apr 2023,

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

2023-04-12 Thread David
In Debian, shell scripts that have #!/usr/bin/sh as the first line are executed by the 'dash' shell. If you write such scripts, you might be interested to know that 'dash' currently has a behaviour change in Debian version 12 Bookworm compared to Debian version 11 Bullseye. This is being