Fix regexp bug in previous change. Add run-time diagnostics.
authorChris Hanson <org/chris-hanson/cph>
Sat, 28 Jan 2017 04:46:57 +0000 (20:46 -0800)
committerChris Hanson <org/chris-hanson/cph>
Sat, 28 Jan 2017 04:46:57 +0000 (20:46 -0800)
etc/run-three-stages

index 0e24f37651e558887d37860ca6e45fe7549d8f77..f1ef7d458384f125e20ae48ff594f1d36c2baa99 100755 (executable)
@@ -46,19 +46,22 @@ if [[ ${1} = -n ]]; then
     declare -r NORUN=t
     shift
 else
-    declare -r NORUN=
+    declare -r NORUN=nil
 fi
 
-if [[ ${1} =~ -?([[:digit:]]+) ]]; then
+if [[ ${1} =~ ^-?([[:digit:]]+)$ ]]; then
     declare -ri MAX_STAGE=${BASH_REMATCH[1]}
     shift
 else
     declare -ri MAX_STAGE=3
 fi
-[[ -n ${NORUN} ]] && echo "MAX_STAGE =" "${MAX_STAGE}"
 
 CONFIG_ARGS=("${@}")
 
+echo "NORUN = " "${NORUN}"
+echo "MAX_STAGE =" "${MAX_STAGE}"
+echo "CONFIG_ARGS =" "${CONFIG_ARGS[@]}"
+
 # Hack for cph
 if which cpx > /dev/null; then
     : ${COPY:="cpx -sq"}
@@ -73,7 +76,7 @@ run_stage ()
     find_stage stage$((N-1))
     echo "MIT_SCHEME_EXE =" "${MIT_SCHEME_EXE}"
     echo "MITSCHEME_LIBRARY_PATH =" "${MITSCHEME_LIBRARY_PATH}"
-    [[ -n ${NORUN} ]] && return 0
+    [[ ${NORUN} = t ]] && return 0
     rm -rf ${STAGE}
     ${COPY} src ${STAGE}
     (set -e; cd ${STAGE}; ./Setup.sh && ./configure "${CONFIG_ARGS[@]}" && make)