When I execute A & B
and then cancel with ^C
only B gets killed, and A runs on the background. How can I execute A & B
as one command I can kill without killing the background job ?
Asked
Active
Viewed 129 times
A & B
as 'one command.'" Do you mean you want them to execute sequentially rather than concurrently? To have the same PID (which is impossible)? To have one be a child of the other? To have one die when the other is killed? "One command" is quite vague; A and B are separate simple commands however you connect them (whether in a pipeline, a list, a compound command, or other method.) – Wildcard Dec 12 '16 at 01:45~$ trap 'kill %1; kill %2' SIGINT
;~$ command1 & command2 & command3
– mrwhale Dec 12 '16 at 01:47