#!/bin/sh # Usage: turnon [exp script] ... # or: turnon -s [solver exe] ... -f [exp script] ... if [ $# -lt 3 ] ; then echo "Usage: turnon [exp script] ..." echo "or: turnon -s [solver exe] ... -f [exp script] ..." echo echo "In the second usage, the output directory is assumed to be the same as" echo "the solver executable's name." exit 1 fi if [ $1 = "-s" ] ; then shift while [ $1 != "-f" ] ; do SOLVERS="$SOLVERS $1" shift if [ $# = 0 ] ; then echo "Expecting -f followed by one or more arguments." exit 1 fi done shift if [ $# == 0 ] ; then echo "Expecting one or more -f arguments." exit 1 fi while [ $# != 0 ] ; do SCRIPTS="$SCRIPTS $1" shift done for f in $SCRIPTS ; do turnoffall $f for s in $SOLVERS ; do turnon $s $s $f done done else OUTNAME=$1 shift EXENAME=$1 shift for f ; do sed -e "/$OUTNAME $EXENAME/s/racing 0/racing 1/" $f > /tmp/_turnon$$ if [ -s /tmp/_turnon$$ ] ; then mv /tmp/_turnon$$ $f else rm /tmp/_turnon$$ echo "Empty file resulted from attempt to process file: $f" echo "Aborting." exit 1 fi done fi