variable

BASH_COMPAT

Select specific historical semantics, not an earlier binary. Introduced in 4.3.

Formal Syntax & Structure

bash syntaxbash
BASH_COMPAT=4.2

Return Value

compatibility level

Select specific historical semantics, not an earlier binary. Introduced in 4.3.

Working Example

Example Snippetbash
before=$BASH_VERSIONBASH_COMPAT=4.2printf 'level=%s\n' "$BASH_COMPAT"if [ "$before" = "$BASH_VERSION" ]; then printf 'same interpreter\n'; fi
Bash Reference