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.py
  • print(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

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -