Skip to content

Fix for warning message that spam on windows bash 5.3 only - #572

Merged
andyneff merged 1 commit into
mainfrom
bash_5.3_windows_compatibility
Sep 24, 2026
Merged

andyneff merged 1 commit into
mainfrom
bash_5.3_windows_compatibility

Conversation

@andyneff

Copy link
Copy Markdown
Member

Running [[ foo =~ '' ]] on windows bash 5.3 generates an error message. This should silence the error and get the result we want.

Background

This compatibility check was originally added for macos's bash. This is checking if the regex module that bash was compiled against support empty string and non-literal escape codes. This compatibility is a function of the regex not a function of bash or bash version. So it must be checked to detect it. Previous to bash 5.3, it always just silently returns exit code 2. However on windows, it starts spewing out an warning message. I suspect it's a new behavior in bash 5.3 and not a change in the regex module.

The core behavior hasn't changed, so the logic is still good, I just need to hide the error message. This will never show up on macos, because they will be forever bash 3.2.

Signed-off-by: Andy Neff <andy@visionsystemsinc.com>
@andyneff andyneff self-assigned this Sep 23, 2026
@andyneff
andyneff merged commit aa0e94b into main Sep 24, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants