All pastes #237443 Raw Edit

Untitled

public text v1 · immutable
·published 2006-11-04 15:30 UTC
rendered paste body
this works: loop "mycommand -parms" 5
this doesn't: loop "mycommand -parms | othercommand" 5

#!/bin/bash
# Loop a command 
# Usage loop "command" delay_between_loops

I=1
while [ 1 ]
do
$1
echo
echo "*** Loop $I ended ***"
echo
sleep $2
I=`expr $I + 1`
done