bash - Execute simultaneous commands and quit when one finishes -
i hope question hasn't been asked many times couldn't find answer on google (i didn't know how specify it).
does know how execute 2 parallel commands in bash but, when 1 finishes, other finish?
for instance, have 2 different python scripts :
while 1: pass
: loop.pyprint(42)
: print.py
i python3 loop.py ** python3 print.py
. 2 scripts must run in parallel , when print finishes, loop end automatically.
my usage of command make like:
tcpdump -i -w out.trace ** python3 network_script.py
thank in advance
what want is
tcpdump ... & pid=$! python3 network_script.py kill $pid
run first script in background, start second script. when second script ends, kill first one.
Comments
Post a Comment