I would like to have the following command structure:command && check-status | less && followup-commandThis would pause the execution while the user interacted with less. How can the user force less to exit with a non-zero status to prevent followup-command from running?I am currently using less 458 (POSIX regular expressions)
Cause `less` to exit with a non-zero status code?
less;user interface;return status
In the simple case, you can ask less not to handle SIGINT, then Control-C will kill it and the exit code will be non-zero. Do this with option -K.command && check-status | less -K && followup-commandAs a workaround for older versions of less, you can do something likecommand && bash -c 'trap exit 1 int;check-status | less -K;' && followup-commandIf you don't have -K, omit it, but you'll have to signal and then type quit too.