I've been using bash's
edit-and-execute-command (C-x C-e)
Invoke an editor on the current command line, and execute the result as shell commands. Bash attempts to invoke
emacsas the editor, in that order.
I've noticed that if I invoke an editor,
use Ctrl-Z to put it into the background,
and then use
fg to put it back into the foreground,
the shell no longer executes the temporary file.
This is handy if I want to abort the command, but I found the behavior a little surprising the first time it happened.
Why does this happen?
I know from the source code that
fc, but it's not immediately clear to me why sending SIGTSTP prevents bash from executing the temporary file.
If I had accidentally hit Ctrl-Z and still wanted to execute the script in the temporary file still open by the editor, what would be the best way of doing that?