Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Repeat.

Name: Anonymous 2013-09-29 17:24

$ cat repeat.py

import sys
import os
c = sys.argv[1]
i = int(sys.argv[2])

com = open('com.sh', 'w+')
com.write(c)
com.close()
os.system("chmod +x com.sh")

n = 0
while n <= i:
     n = n + 1
     os.system("./com.sh")


$cat repeat

#!/bin/bash
python repeat.py "$1" "$2"

if [ $? != 0 ] ; then
echo "
Usage: repeat ['command'] [# of times to repeat]
EG. repeat 'ls -a' 5
If the command contains spaces, it must be contained in quotes.
"
fi


Rate my code.

Name: Anonymous 2013-09-29 19:59

EXPERT quality

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List