Added gitignore entries needed to ignore derived objects generated from full build...
[bash.git] / examples / scripts.noah / bash_version.bash
blob4ea737bee8082583493080d005d7fc2d4cbb80d6
1 # bash_version.bash --- get major and minor components of bash version number
2 # Author: Noah Friedman <friedman@prep.ai.mit.edu>
3 # Created: 1993-01-26
4 # Last modified: 1993-01-26
5 # Public domain
7 # Converted to bash v2 syntax by Chet Ramey
9 # Commentary:
10 # Code:
12 #:docstring bash_version:
13 # Usage: bash_version {major|minor}
15 # Echo the major or minor number of this version of bash on stdout, or
16 # just echo $BASH_VERSION if no argument is given.
17 #:end docstring:
19 ###;;;autoload
20 function bash_version ()
22 local major minor
24 case "$1" in
25 major) echo "${BASH_VERSION/.*/}" ;;
26 minor) major="${BASH_VERSION/.*/}"
27 minor="${BASH_VERSION#${major}.}"
28 echo "${minor%%.*}" ;;
29 patchlevel) minor="${BASH_VERSION#*.*.}"
30 echo "${minor%(*}" ;;
31 version) minor=${BASH_VERSION/#*.*./}
32 echo ${BASH_VERSION/%.$minor/} ;;
33 release) echo ${BASH_VERSION%(*} ;;
34 build) minor="${BASH_VERSION#*.*.*(}"
35 echo ${minor%)} ;;
36 *) echo "${BASH_VERSION}" ;;
37 esac
40 provide bash_version
42 # bash_version.bash ends here