# HG changeset patch # User bulwahn # Date 1296651186 -3600 # Node ID 53b1da988e752790c5b0afcc894f24610ae6a915 # Parent 3e39b0e730d6f3579551c8d9fd34eeae358b2591 making the bash script swipl_version closer to Isabelle's conventional bash scripts diff -r 3e39b0e730d6 -r 53b1da988e75 src/HOL/Tools/Predicate_Compile/etc/settings --- a/src/HOL/Tools/Predicate_Compile/etc/settings Wed Feb 02 12:34:45 2011 +0100 +++ b/src/HOL/Tools/Predicate_Compile/etc/settings Wed Feb 02 13:53:06 2011 +0100 @@ -17,4 +17,4 @@ $(type -p yap) \ "")" -SWIPL_VERSION=$("$COMPONENT/lib/scripts/swipl_version") +SWIPL_VERSION="$("$COMPONENT/lib/scripts/swipl_version")" diff -r 3e39b0e730d6 -r 53b1da988e75 src/HOL/Tools/Predicate_Compile/lib/scripts/swipl_version --- a/src/HOL/Tools/Predicate_Compile/lib/scripts/swipl_version Wed Feb 02 12:34:45 2011 +0100 +++ b/src/HOL/Tools/Predicate_Compile/lib/scripts/swipl_version Wed Feb 02 13:53:06 2011 +0100 @@ -7,9 +7,11 @@ if [ "$EXEC_SWIPL" = "" ]; then echo "" else - # FIXME does not allow spaces in $EXEC_SWIPL - # FIXME "expr match" not portable - # FIXME prefer $(...) in bash - VERSION=`$EXEC_SWIPL --version` - echo `expr match "$VERSION" 'SWI-Prolog version \([0-9\.]*\)'` + VERSION="$("$EXEC_SWIPL" --version)" + REGEXP='^SWI-Prolog version ([0-9\.]*) for .*$' + if [[ "$VERSION" =~ $REGEXP ]]; then + echo "${BASH_REMATCH[1]}" + else + echo undefined + fi fi