eliminated old-style sed in favour of builtin regex matching;
authorwenzelm
Mon Nov 15 17:39:23 2010 +0100 (2010-11-15)
changeset 40546f46c902a8438
parent 40545 956c2cc7fced
child 40547 05a82b4bccbc
eliminated old-style sed in favour of builtin regex matching;
lib/scripts/polyml-version
     1.1 --- a/lib/scripts/polyml-version	Mon Nov 15 17:14:43 2010 +0100
     1.2 +++ b/lib/scripts/polyml-version	Mon Nov 15 17:39:23 2010 +0100
     1.3 @@ -2,11 +2,17 @@
     1.4  #
     1.5  # polyml-version --- determine Poly/ML runtime system version
     1.6  
     1.7 -echo -n polyml
     1.8 -
     1.9  if [ -x "$ML_HOME/poly" ]; then
    1.10 -  env LD_LIBRARY_PATH="$ML_HOME:$ML_HOME/../lib:$LD_LIBRARY_PATH" \
    1.11 +  VERSION="$(env \
    1.12 +    LD_LIBRARY_PATH="$ML_HOME:$ML_HOME/../lib:$LD_LIBRARY_PATH" \
    1.13      DYLD_LIBRARY_PATH="$ML_HOME:$ML_HOME/../lib:$DYLD_LIBRARY_PATH" \
    1.14 -    "$ML_HOME/poly" -v -H 10 | \
    1.15 -    sed -n 's,^Poly/ML.*RTS version: [^ ]*\(-[^ ]*\).*$,\1,p'
    1.16 +    "$ML_HOME/poly" -v -H 10)"
    1.17 +  REGEXP='^Poly/ML.*RTS version: [^ ]*(-[^ ]*).*$'
    1.18 +  if [[ "$VERSION" =~ $REGEXP ]]; then
    1.19 +    echo "polyml${BASH_REMATCH[1]}"
    1.20 +  else
    1.21 +    echo polyml-unknown
    1.22 +  fi
    1.23 +else
    1.24 +  echo polyml-unknown
    1.25  fi