#!/bin/csh -f # loop # ------------------------------------------------------------------------------ # Shell script to loop, repeating the specified command with a specified # delay. # ------------------------------------------------------------------------- # Revision History: # $Log$ # ------------------------------------------------------------------------------ if ($#argv < 2 || "$1" == "-h" || "$1" == "--help") then echo "Usage: $0:t [-q] seconds command" echo " where -q = Quiet mode" echo "Example: $0:t 1 dir *.exe" echo "Example: $0:t -q 10 dir *.exe" echo "Example: $0:t 0.5 dir *.exe" exit 1 endif set quiet = false if ("$1" == "-q") then shift set quiet = true endif set seconds = $1 shift echo "Looping every $seconds seconds. Hit Ctrl-C to stop..." while (1 == 1) $*:q if ("$quiet" == "false") then date echo "About to wait $seconds seconds..." endif sleep $seconds end exit $status