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.

3
  • Please show what you did, and what happened. Then proofread, and re-write, so that it makes sense to someone that does not already know what you are asking. Commented Jul 25, 2018 at 13:21
  • I gave a minimized example. Which parts do I need to clarify? Commented Jul 25, 2018 at 13:53
  • I can not tell you what to show, as I have not seen it. But with your minimal example, show what you did, what you expected, and what happened. Commented Jul 25, 2018 at 15:21

1 Answer 1

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.

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.