loop with until?

I want to have a loop or check in a bash script before going further, i was thinking to check the size a working directory, so …

if the size of dir (with command du ?) is 5 sec equal then start …

how can i make that?
so checking dir size, wait 5 sec, checking again, if equal go futher in script.

It would have been nice when you would have mentioned the language this is about in the title: bash. So that C, Perl, Ruby, PHP, etc. etc. people could skip over it and bash people would come to help you :wink:

I do not know what you tried or what you are missing. But there is a command “sleep”. Thus something like

du -s dir | read S1 X
sleep 5
du -s dir | read S2 X
if ........... 

As always, read the man pages.