def runCommand(command): print 'Running:', command f = os.popen(command, "r") # set output colour: sys.stdout.write("[31;2m") ; sys.stdout.flush() for l in f.xreadlines(): print ' ', l, # reset output colour sys.stdout.write("[0m")