variable

BASH_VERSION

Descriptive version string of the running Bash; not suitable for lexical numeric comparison.

Formal Syntax & Structure

bash syntaxbash
$BASH_VERSION

Return Value

version string

Descriptive version string of the running Bash; not suitable for lexical numeric comparison.

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