import os
commands = ['uname -v', 'whoami']
a = 0
numberIterations = 2 # How to make a command line argument of a while loop number?
while a < numberIterations:
print "#--- Iteration: %s ---#" % a
i = 0
while i < len(commands):
print "$", commands[i]
os.system(commands[i])
i = i + 1
print ""
a = a + 1
我想以这种格式运行脚本:
./script.py "numberIterations"