[NTLUG:Discuss] Simple way to repeat command every 'x' seconds

Fred James fredjame at concentric.net
Mon Apr 14 08:35:30 CDT 2003


#! /bin/bash
#   doforever.sh
if test $# -eq 1
then
    Pause=$1
else
    Pause=20
fi
while test 1
do
    du - H -s
    sleep $Pause
done
exit

Then either of these could be used:
#> ./doforever.sh
#> ./doforever.sh 30
I don't know if you would want to put that in the background, and I 
believe that it would terminate when your shell did.

Jack Snodgrass wrote:

>I want to be able to do something like
>do forever
>   du -H -s 
>   sleep 20 seconds 
>loop
>
>from the command line with a simple command. Is there something 
>already out there that does this, or do I have to write a script? 
>
>jack
>
>
>_______________________________________________
>https://ntlug.org/mailman/listinfo/discuss
>  
>
-- 
"It's not nice to fool Mother OS." --anonymous





More information about the Discuss mailing list