How to exit with an error code from nano?
This is what I can do in interactive sh
(or bash
etc.) with job control:
I can suspend nano
with Ctrl+Z (^Z
). Note: if the message is Suspension is not enabled
then I need to press Alt+Z (M-Z
) to enable. As far as I know these are default keybindings in nano
.
If the command was nano || foo
then foo
will be triggered immediately.
Now I'm back in the shell with nano
as a job (see jobs
). kill %%
will send a signal to it, still nano
won't exit yet. I need to fg
after sending the signal, only then nano
terminates.
Not as fast as vim's :cq
but still without additional SSH session.