Re: $!() gives a list of files

Matti Andreas Kähäri <[email protected]> Thu, 16 Apr 2026 06:51:33 +0200
Newsgroups gmane.comp.shells.bash.bugs
Message-ID <[email protected]>
On Wed, Apr 15, 2026 at 09:10:20AM +0100, Andrew Young wrote:
[cut]
> Description:
>         The sequence !() seems to generate a list of files in the current
> directory, possibly leading to unintended execution

Only if you have the extglob shell option enabled, which is not the
default.  With that shell option enabled, the globbing pattern
!(something) matches any file that does not match "something".

This is not a bug in the shell, but in your code.


-- 
Matti Andreas Kähäri
Uppsala, Sweden

///