0

For license reasons, OS X comes with an ancient version of bash (3.2.57, while the current stable bash version is 5.1). Since I could install the latest bash version myself, I was wondering: What am I missing? What are the major / most useful features of modern bash that are missing from the Apple version?

I've tried looking at the release history but it's too full of little details and bug fixes...

PS This question is about bash. I am aware that Apple has switched to zsh as the default OS X shell, but I do not need a comparison of bash vs. zsh features.

Kusalananda
  • 333,661
alexis
  • 5,759
  • AFAIK, the only place to get that information is to review the release history. But you need not suffer with Apple's self-serving decisions. Get a package manager (I use macports), and run the latest version of bash - at least until Apple figures out how to break that also. – Seamus Aug 15 '21 at 20:46
  • @Seamus, stackoverflow could be another good place to get the information I'm after, summarized by somebody who knows ;-) . – alexis Aug 15 '21 at 21:24

1 Answers1

4

Associative arrays. Namerefs (a, b). globstar (** as a recursive glob). mapfile/readarray. Some minor stuff.

See the list of changes in the Bash hackers' wiki. The site also has a page for a rough overview of Bash 4

Or the NEWS and CHANGES files from the source tree for the full raw list (also CWRU/changelog for a more detailed list, though you'll need to look at that file in all versions since 3.2 for the full list since then).

ilkkachu
  • 138,973
  • Also mapfile (aka readarray), and a bunch of modifiers/transformations on variable expansions (e.g. ${var^} will capitalize first letter, ${var@Q} will add quotes/escapes, etc). – Gordon Davisson Aug 15 '21 at 20:53
  • @GordonDavisson, yep. I think read -a can possibly be used to replace mapfile, but I didn't think what the limitations really are. 3.2 has printf %q and IMO the others are relatively minor... – ilkkachu Aug 15 '21 at 21:18