summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorGravatar Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com>2013-02-24 10:48:04 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-02-24 06:43:25 -0800
commit9ceb65a3ce9b66431c6c22e6f09e1d05c29b65e0 (patch)
tree80875550e26b878786b36f35e965383db2076d99 /scripts
parent77a6b18a7158e3239f1dfcb79a73bf6ea8f4b620 (diff)
downloadsubsurface-9ceb65a3ce9b66431c6c22e6f09e1d05c29b65e0.tar.gz
Use a posix equivalent solution instead of the pattern substitution bashism.
Signed-off-by: Cristian Ionescu-Idbohrn <cristian.ionescu-idbohrn@axis.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/get-version8
1 files changed, 5 insertions, 3 deletions
diff --git a/scripts/get-version b/scripts/get-version
index d4fb0b769..8fcb6b212 100755
--- a/scripts/get-version
+++ b/scripts/get-version
@@ -32,7 +32,9 @@ case $os in
darwin|win)
# just the dots in the version string - this way we can
# count them
- dots="${v0//[^.]}"
+ IFS=.
+ set -- $v0 # split $v0 using $IFS separator
+ dots=$(($# - 1)) # use positional argument count
# split version string using a '-' separator
IFS='-'
set -- $v0
@@ -40,7 +42,7 @@ case $os in
# do we need to add another digit?
# We know there are 1 or 2 dots in $v, so if it's just one
# or we are trying to get to 4, add one digit
- if [ ${#dots} -eq 1 ] || [ $os = win ]; then
+ if [ $dots -eq 1 ] || [ $os = win ]; then
if [ $# -gt 1 ]; then
v=$v.$2
else
@@ -48,7 +50,7 @@ case $os in
fi
fi
# and if it was just one dot and we want 4, at another 0
- if [ ${#dots} -eq 1 ] && [ $os = win ]; then
+ if [ $dots -eq 1 ] && [ $os = win ]; then
v=$v.0
fi
;;