linux - Why SIGINT can stop bash in terminal but not via kill -INT? -


I have seen that when I am running a hanging process through Bash script like this

Foo.sh:

  Sleep 999   

If I run it through the command, and press Ctrl + C

 < Code>. / Foo.sh ^ c   

Sleep will get interrupted. However, when I call it SIGINT

  ps aux | I'm trying to kill Grep foo kill -INT 12345 # the / bin / bash ./foo.sh process   

Then it looks like bash and ignore the SIGINT and ignore the ON to keep. I wonder if I thought that Ctrl + C is actually sending SIGINT in the process of forwarding, so why such behavior is for Ctrl + C in different terminal and kill -INT?

Ctrl c actually SIGINT sends the foreground process to the group (which includes a bash process and a sleep process). To do this with the kill command, send the signal to the process group, such as:

  kill -INT-12345    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -