Show More
@@ -0,0 +1,23 b'' | |||||
|
1 | #!/usr/bin/env python | |||
|
2 | # | |||
|
3 | # A portable replacement for 'seq' | |||
|
4 | # | |||
|
5 | # Usage: | |||
|
6 | # seq STOP [1, STOP] stepping by 1 | |||
|
7 | # seq START STOP [START, STOP] stepping by 1 | |||
|
8 | # seq START STEP STOP [START, STOP] stepping by STEP | |||
|
9 | ||||
|
10 | import sys | |||
|
11 | ||||
|
12 | start = 1 | |||
|
13 | if len(sys.argv) > 2: | |||
|
14 | start = int(sys.argv[1]) | |||
|
15 | ||||
|
16 | step = 1 | |||
|
17 | if len(sys.argv) > 3: | |||
|
18 | step = int(sys.argv[2]) | |||
|
19 | ||||
|
20 | stop = int(sys.argv[-1]) + 1 | |||
|
21 | ||||
|
22 | for i in xrange(start, stop, step): | |||
|
23 | print i |
General Comments 0
You need to be logged in to leave comments.
Login now