Reputation: 79
I know what the command watch -n does. I would like to do something like the following:
watch -n 5 "ls" //Do this for 30 minutes, then stop.
Essentially I want to repeat a command every 5 seconds, then stop after 30 minutes has passed. I'm missing the stop 30 minutes part. What command should I use to achieve this?
Thanks.
Upvotes: 2
Views: 105
Reputation: 409
You can use the timeout command, that is part of coreutils, something like:
timeout 30m watch -n 5 "ls"
Upvotes: 3