Quote:
Originally Posted by merchtemeagle
(c1 & c2) && c3
|
Sadly, if I run for excample (sleep 4 & echo hi & echo test) && echo end. Bash prints hi, test and end instantly. Not waiting for the sleep.
I've made a very simple pythonscript for the purpose:
Code:
import sys, os, time, threading
from threading import Thread
class commandThread(Thread):
def __init__(self, command):
self.command = command
Thread.__init__(self)
def run(self):
os.system(self.command)
for command in sys.argv[1:]:
thread = commandThread(command)
thread.start()
while threading.activeCount() > 1:
time.sleep(1)
You run it like
Code:
./scriptname.py "echo hi" "echo test"; echo end