Which is more efficient - sleep or infinite while?

Hi
i need to make a script to check disk space every hour.

****Note that cron is not allowed.

So i need to use either sleep or while 1 ...pls suggest which is more efficient in this scenario?

And is there any other way to do the task?

Thanks,
Ashish

The most efficient and simple way is while and sleep.

while [ 1 ]
do
    your_stuff...
    sleep 3600
done

Hi thanks for reply ..
if i use sleep with goto ..will that be moe effiecient as comapred to while 1?

Also what are drawbacks of sleep and while 1.

I would say that's pretty much the same thing (while and goto) but for the sake of simplicity I would advise you go use while.

There are no drawbacks in sleep and while 1. It does it's job and then simply does nothing for 3600 seconds.

actaully, as i have recently learned, [ 1 ] is not the best way

while :
do
     some stuff
     sleep 11101
done

I always use
while : ; do
myself and I would never use
while [ 1 ] ; do
but I wonder why you object to it. I object to it because it is a terribly misleading construct:

$ [ 1 ] && echo yes
yes
$ [ 0 ] && echo yes
yes
$ [ xyzzy ] && echo yes
yes
$

Few people expect all 3 of those to behave the same. But assuming that : and [ are both shell built-in commands, they should be about as fast.

you wanna know the draw back of sleep??
try running
timex sleep 60
it will give any idea..

well, [ 1 ] implies the shell executes all the code for the builtin test
as i undestand it, the ":" is more closer to null code...
yes, both are built in, but im sure [ has tons of lines to work as the external test (and all the testing capabilitie it has)
: "looks & feels slimer"