Unnamed
public text v1 · immutableprocesses = openPipe(["ps", "-A"])
found = []
for arg in sys.argv[1:]:
match = False
for line in processes:
if arg in line:
found.append(line)
match = True
if not match:
print "%s was not found!" % arg
time.sleep(2)
if not found:
sys.exit("No matches found")
pids = []
for line in found:
pid = line.strip().split(" ")[0]
pids.append(pid)
param = ""
for pid in pids:
param += "-p%s " % pid
os.system("top %s" % param)