1

I had a bash script which did the wrong thing. So I pressed Ctrl-C to stop it.

Is now the output I currently see on my terminal all the output produced by the processes that have run. Are does Ctrl-C also prevent output to be printed even though the process that wanted to output something has run/finished what it was doing.

So, I do:

for i in *; do rm -vf $i; done

Can I now be sure that all removed 'file' messages on my screen are those that are removed and nothing more has been removed?

Maybe relevant info: I worked in a screen session over ssh.

1 Answers1

1

Essentially yes.

After the shell process catches your Ctrl-C interrupt, it stops it.

There are caveats however, such as in a for loop there can be a cmd that runs in the background.

Plus there are some cmds that run so quickly that you do not get a fast response from the shell (especially over a remote connection!) that it has or when it has actually received your "interruption" using Ctrl-C.

Cometsong
  • 160