Last active
May 7, 2019 02:27
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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