How can I run two commands in parallel and terminate them if ONE of them terminates with exit code 0?
9
votes
2
answers
8474
views
I have 2 commands which are to be run simultaneously. And I want the script to terminate if one of them either exits with code 0 or 1. How can I achieve this in Linux(Ubuntu)
cmd1 &
cmd2 &
wait
Asked by Sam
(91 rep)
Jan 10, 2017, 08:33 PM
Last activity: Feb 16, 2024, 08:05 PM
Last activity: Feb 16, 2024, 08:05 PM