[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: bash parameter expansion "doesn't like" dots?



On 05/03/2024 11:02, Greg Wooledge wrote:
On Tue, Mar 05, 2024 at 10:49:34AM +0900, John Crawley wrote:
On 05/03/2024 05:27, David Wright wrote:
Which shell also matters. The OP appears to be using ^ to negate,
but ! has the advantage that it will be understood in bash and dash.

I think ^ has been deprecated recently. I failed to find a reference on the web just now though.

POSIX specifies that ! is the negation character in glob ranges, largely
because ^ used to be a synonym for | in the old Bourne shell (for the
benefit of keyboards that didn't have a convenient | character).

The use of ^ as a glob negation is a bash extension.  It's nice for
people who may not even realize that they're supposed to be using !
because they learned regular expressions first.

So, ^ isn't "deprecated".  It's just not portable to sh.

^ worked as a negator in dash character classes up to Bullseye though, so something has changed recently. That's what my web searching failed to find...

--
John


Reply to: