I've been using bash's edit-and-execute-command
function:
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
$VISUAL
,$EDITOR
, andemacs
as the editor, in that order.
https://www.gnu.org/software/bash/manual/html_node/Miscellaneous-Commands.html
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.
My questions:
Why does this happen?
I know from the source code that
edit_and_execute_command
eventually callsfc
, 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?
fg
and it works just fine. But the shell doesn't execute the temporary file afterwards. That's the question. – Nathaniel M. Beaver Jan 24 '20 at 13:48SIGCONT
like in https://unix.stackexchange.com/questions/246780/how-to-resume-a-suspended-shell/246781 – ralf htp Jan 24 '20 at 14:25ps -e --forest
or print the childs withps -C processname
like in https://www.tecmint.com/ps-command-examples-for-linux-process-monitoring/ – ralf htp Jan 25 '20 at 15:28