Ctrl-C with two simultaneous commands in bash
23
votes
5
answers
22097
views
I want to run two commands simultaneously in bash on a Linux machine. Therefore in my
./execute.sh
bash script I put:
command 1 & command 2
echo "done"
However when I want to stop the bash script and hit Ctrl+C, only the second command is stopped. The first command keeps running.
How do I make sure that the complete bash script is stopped? Or in any case, how do I stop both commands? Because in this case no matter how often I press Ctrl+C the command keeps running and I am forced to close the terminal.
Asked by maero21
(333 rep)
Jan 1, 2014, 01:54 PM
Last activity: Mar 21, 2025, 11:25 AM
Last activity: Mar 21, 2025, 11:25 AM