Artificial intelligent assistant

Why is the bash double star (globstar) operator often disabled by default? It seems to be a very useful feature. But I had to learn that it is often disabled by default. I though about enabling it on my system. But there is probably a good reason why it is disabled. Without knowning that, it seems unwise to enable it. Therefore my question: Why is the bash double star operator often disabled by default? I found multiple questions about how it is enabled, what the operator is named and how to use it. All of them mention that it has to be enabled first. But none of the questions explains _why_ it is disabled by default.

Hard to say for sure without asking the developer.

In any case, it's an incompatible extension that was added to Bash only in 2009 (after being implemented earlier in zsh, ksh93 and yash). It's also one that can have surprising results if triggered accidentally. Perhaps even dangerous ones, e.g. if a script does something like


rm -- "$dir"/*$pattern*/* # or
rm -- "$dir"/*"$string"*/*


without making sure `$pattern` is non-empty. _Yes_ , both do trigger `globstar` in Bash (when enabled).

The same caveat applies to most other shells that have `**`: `zsh`, `ksh93 -o globstar`, `tcsh` (after `set globstar`) and `yash -o extended-glob`. Not `fish`, though: it has `**` with somewhat different semantics, but it doesn't trigger it with something inbetween the two asterisks.

See e.g. Stéphane's answer in The result of ls * , ls ** and ls *** for the history and the differences between the implementations in various shells.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 8a69c99a9e9358e24c6ba8b7a888e1e9