Is there already one bash command to do what the following script does (poorly 
or incompletely), ie repeat "command" indefinitely every "x" seconds:

#!/bin/sh
# usage: repeat [x] <command>
while true ; do $2 ; sleep $1 ; done


if not, and you want to use the above in a script of your own, just copy the 
above 3 lines and do the following (typing the lines into the console or 
pasting them in shell, using konsole under kde or gpm under a tty shell; hit 
<Ctrl-c> to stop it from looping). The two examples are optional. The stuff in 
angle brackets, <>, is stuff you won't see in your shell output:

[EMAIL PROTECTED] cat >repeat
#!/bin/sh
# usage: repeat [x] <command>
while true ; do $2 ; sleep $1 ; done
[EMAIL PROTECTED] chmod +x repeat
<examples>
[EMAIL PROTECTED] ./repeat 2 "cat /proc/loadavg"
0.46 0.92 1.72 9/125 24171
0.46 0.92 1.72 2/125 24173
0.59 0.94 1.72 1/125 24181
<Ctrl-c>
[EMAIL PROTECTED] cd ..
[EMAIL PROTECTED] repeat 2 uname
Linux
Linux
<Ctrl-c>

btw: i've already posted the same to:
http://www.linuxquestions.org/questions/showthread.php?s=&threadid=343892

some answers might show up there before i get back 

-- 
AD Marshall
Tel:  +84 (0)903871313
eM:   [EMAIL PROTECTED]
Web:  http://h0lug.sourceforge.net
Zone: ICT (IndoChina Time; GMT/UTC+7)
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

Reply via email to