The way to keep `watch` running indefinitely until it's stopped manually?
Published on Aug. 22, 2023, 12:20 p.m.
To keep watch
running indefinitely until it’s stopped manually, you can use the -n
flag followed by a large number to make watch
repeat the command at a sufficiently long interval. For example:
watch -n 9999 command
This will repeat the command
every 9999 seconds, effectively making watch
continue to run until stopped manually.
Note that there is no way to set watch
to run indefinitely by default, as it is designed to run a specific number of times and then stop. However, using a large number with the -n
flag as shown above can effectively achieve the same result.