How can I set the compatibility level in Bash 4?

Solution Unverified - Updated -

Issue

Some bash scripts that worked correctly on Red Hat Enterprise Linux 4 and 5 are not working since we upgraded to version 6. A script like the following used to work on versions prior to bash version 4.x shipped in RHEL 6:

$ [[ "20110228" =~ '^[0-9]{8}$' ]] && echo matches
$

In previous bash versions it printed matches

Environment

  • Red Hat Enterprise Linux 6
  • Bash 4.X

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.

Current Customers and Partners

Log in for full access

Log In
Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.