Wednesday, August 26, 2015

I Repeat...

I'm always forgetting how to repeat a command. Here's how in tcsh:

$ repeat 9999 sh -c 'now=`date +%s` ; date > /tmp/tmp ; then=`date +%s` ; diff=`expr ${then} - ${now}` ; echo xxxxx ${diff} xxxxx ; if [ ${diff} -gt 0 ] ; then date ; fi ; sleep 15'

(The inner command is /bin/sh, of course)