I want to run two commands simultaneously in bash script (one of them is another bash script) and I need both of them to stop when I press Ctrl+C. My bash script now is:
#!/bin/bash
./command1 &
exec "/path/to/bash2"
and in bash2:
#!/bin/bash
[..]
python run.py
Should I add a trap to kill both commands? If so, adding the following in bash did not help
trap killgroup SIGINT
killgroup(){
echo killing...
kill 0
}