Skip to content

Instantly share code, notes, and snippets.

@o0-o
Last active May 7, 2019 02:27
Show Gist options
  • Save o0-o/0aa3cdc6c2891639f93ce0ff1a41c1f8 to your computer and use it in GitHub Desktop.
Save o0-o/0aa3cdc6c2891639f93ce0ff1a41c1f8 to your computer and use it in GitHub Desktop.
[Bash Version] Prints the version of bash that is locally installed #Shell
# bash_version.sh
( bash --version |
grep --only-matching --max-count=1 "([0-9]*\.){2}[0-9]*" |
head -n 1 #`head --lines=` isn't portable, so `-n` is used
) 2>/dev/null ||
exit 1 #failure
exit 0 #success
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment