When I start a dd process directly from the Terminal with
dd if=/dev/zero of=/dev/null &
command, and send to it a -SIGINT with
kill -SIGINT <pid>
command, it closes successfully.
But when I start the process from a script
#!/bin/sh
dd if=/dev/zero of=/dev/null &
Then do
kill -SIGINT <pid>
it doesn't affect the process.
I wonder why this is so.
I didn't find any related information on the internet.
POSIX says:
This is likely because Ctrl+C sends a sigint to every process in the group, so without this behavior, any backgrounded processes would unexpectedly be killed when you try to interrupt the main script.