From: Colin Patrick Mccabe Date: Fri, 28 Mar 2014 17:55:32 +0000 (-0700) Subject: add ttd: run a command until it fails. X-Git-Url: http://club.cc.cmu.edu/~cmccabe/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a8f2f86bc908138bac692fd6b3e6bb6e2b28ce5b;p=cmccabe-bin add ttd: run a command until it fails. Signed-off-by: Colin McCabe --- diff --git a/ttd b/ttd new file mode 100755 index 0000000..b8ba46c --- /dev/null +++ b/ttd @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +# +# ttd: run a command until it fails. +# +# usage: ttd [num-runs] command +# + +NUM_RUNS=$1 +shift +CMD="${@}" +for i in `seq 1 $NUM_RUNS`; do + ${CMD} + if [ $? -ne 0 ]; then + exit 1 + fi +done + +echo "*** SUCCESSFULLY RAN ${NUM_RUNS} RUNS ***"