run script for given time

Hi!

I need to run my script for a specific number of time, as specified by the user: For instance, if the user specified 10, my script should run for until 10 seconds expire. How do I do this?