5 # Some utilities for dealing with version stamps.
7 function print_instructions {
9 This script processes version numbers in an ini file formatted file. It\n\
10 currently only supports one set of version numbers in the file, in the form:\n\
15 The first parameter to the script is a command. The available commands\n\
18 The second parameter is the version file to process.\n\
19 All parameters are required."
25 if [ -z "$command" ]; then print_instructions; fi
27 if [ -z "$version_file" ]; then print_instructions; fi
29 #echo got a command $command and version file $version_file
31 if [ "$command" = "show" ]; then
32 # show the version in the version file.
33 if [ ! -f "$version_file" ]; then
34 echo "The version file \"$version_file\" doesn't seem to exist."
37 major=$(grep 'major=' "$version_file" | sed -e 's/.*major=\([! #]*\)/\1/')
38 minor=$(grep 'minor=' "$version_file" | sed -e 's/.*minor=\([! #]*\)/\1/')
39 revision=$(grep 'revision=' "$version_file" | sed -e 's/.*revision=\([! #]*\)/\1/')
40 build=$(grep 'build=' "$version_file" | sed -e 's/.*build=\([! #]*\)/\1/')
41 #echo major=$major minor=$minor rev=$revision build=$build
43 echo -n $major.$minor.$revision.$build