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.