You can use watch -e or –errexit option to freeze updates on command error, and exit after a keypress. By default, watch command does not stop updates when an error occurred.
Example:
The default behavior of watch command:
1 2 3 |
## default watch cat some_error ## returns an error ## press control + c to exit |
watch -e or –errexit option example:
1 2 3 |
## watch -e or --errexit options watch -e cat some_error ## returns an error ## press any key to exit |