Something related to macOS.
TextEdit usually counts new documents up as Untitled, Untitled 2, Untitled 3. When mine stopped, I went hunting through defaults and saved state. The fix worked, but for entirely the wrong reason.
Installing a newer Bash on macOS via Homebrew is the easy part. Making the OS actually use it.