I use the following pattern often:
some_long_running_command && echo success
However, sometimes I forget to attach the && success, so I write out the status check in the next line:
some_long_running_command
[ $? -eq 0 ] && echo success
As you can see, the status check in the second example ([ $? -eq 0 ] &&) is much more verbose than the check from the first example (&&).
Is there a more concise way to run a command only if the previous command completes successfully, when the previous command is already running?
echo $?. Alternatively, a classic approach would be to modify your prompt to contain the exit status (see here). This way you always see the exit status of the last command.