Skip to content

Instantly share code, notes, and snippets.

@rafaelnp
Created October 20, 2019 15:54
Show Gist options
  • Save rafaelnp/21f5bb3d6e84898d0881951f82885198 to your computer and use it in GitHub Desktop.
Save rafaelnp/21f5bb3d6e84898d0881951f82885198 to your computer and use it in GitHub Desktop.
execute a desired commend N times, useful for quick tests and automations
#!/usr/bin/env python3
"""
execute a command N times
"""
import os
import time
x = 10
y = 0.5
for i in range(x):
# if an invertal between executions is needed
time.sleep(y)
os.system("your_binary -args")
# print the iteration number in the same line if desired
print("execution number: {}".format(i), end = "\r", flush = True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment