Skip to content

Commit f646952

Browse files
dogancandanpovey
authored andcommitted
[build] src/base/get_version.sh: change regexp syntax to support older bash versions. (kaldi-asr#1327)
1 parent 722df9a commit f646952

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/base/get_version.sh

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,10 @@ cd "$(dirname ${BASH_SOURCE[0]})"
3939
# Read the partial version number specified in the first line of src/.version.
4040
version=$(head -1 ../.version)
4141

42-
# Empty version number is not allowed.
43-
if [ -z "$version" ]; then
44-
version="?"
45-
fi
46-
4742
if [ -e ../.short_version ]; then
4843
echo "$0: File src/.short_version exists."
4944
echo "$0: Stopping the construction of full version number from git history."
50-
elif [[ $version != +([0-9]).+([0-9]) ]]; then
45+
elif ! [[ $version =~ ^[0-9][0-9]*.[0-9][0-9]*$ ]]; then
5146
echo "$0: The version number \"$version\" specified in src/.version is not" \
5247
"in MAJOR.MINOR format."
5348
echo "$0: Stopping the construction of full version number from git history."
@@ -76,6 +71,11 @@ else
7671
version="$version-${head_commit_short}"
7772
fi
7873

74+
# Empty version number is not allowed.
75+
if [ -z "$version" ]; then
76+
version="?"
77+
fi
78+
7979
# Write version info to a temporary file.
8080
temp=$(mktemp)
8181
trap 'rm -f "$temp"' EXIT

0 commit comments

Comments
 (0)