-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiterator-example-run.txt
134 lines (102 loc) · 2.65 KB
/
iterator-example-run.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
```
# Demonstration of "iterator.py" sample script
# A self-contained general-purpose "Thing Doer"
# See script source for details.
# Gary Arthur Douglas Jr | unhacker@gmail.com
[garyd@dizzymouse iterator]$ ./iterator.py typohere
./iterator.py: Invalid mode Typohere
# iterator.py: Run a command on a list of things
# Usage:
# iterator.py show - Show config
# iterator.py things - Edit list of things
# iterator.py command - Edit command
# iterator.py run - Execute current config
# iterator.py help - You are reading it
[garyd@dizzymouse iterator]$ ./iterator.py show
Mode : Show
Command : /tmp/brawl.py _THINGS_
Things : 21 63 20 34 85
[garyd@dizzymouse iterator]$ ./iterator.py things
Mode : Things
Number Thing
------- ------------
0 21
1 63
2 20
3 34
4 85
[A]dd, [D]elete, or [S]ave/quit : d
Enter number to delete, or nothing (to cancel): 0
Thing # 0 deleted!
Number Thing
------- ------------
0 63
1 20
2 34
3 85
[A]dd, [D]elete, or [S]ave/quit : d
Enter number to delete, or nothing (to cancel): 3
Thing # 3 deleted!
Number Thing
------- ------------
0 63
1 20
2 34
[A]dd, [D]elete, or [S]ave/quit : d
Enter number to delete, or nothing (to cancel): 1
Thing # 1 deleted!
Number Thing
------- ------------
0 63
1 34
[A]dd, [D]elete, or [S]ave/quit : a
Enter new Thing, or nothing (to cancel):
/tmp/somefile.txt
Thing added.
Number Thing
------- ------------
0 63
1 34
2 /tmp/somefile.txt
[A]dd, [D]elete, or [S]ave/quit : a
Enter new Thing, or nothing (to cancel):
internalsite.corp.com
Thing added.
Number Thing
------- ------------
0 63
1 34
2 /tmp/somefile.txt
3 internalsite.corp.com
[A]dd, [D]elete, or [S]ave/quit : s
Things updated! Exiting.
[garyd@dizzymouse iterator]$ ./iterator.py command
Mode : Command
Command : /tmp/brawl.py _THINGS_
Things : 63 34 /tmp/somefile.txt internalsite.corp.com
On run, each thing replaces _THINGS_.
Examples:
ping -c 1 _THINGS_
cp _THINGS_ /tmp; ls -l /tmp/_THINGS_
New command: echo "Doing _THINGS_..."
Save? [Y]es, [N]o, or <enter> for next preview.
New command: echo "Doing _THINGS_..."
Preview: echo "Doing 63..."
Preview: echo "Doing 34..."
Preview: echo "Doing /tmp/somefile.txt..." y
Configuration updated! Exiting.
[garyd@dizzymouse iterator]$
[garyd@dizzymouse iterator]$ ./iterator.py show
Mode : Show
Command : echo "Doing _THINGS_..."
Things : 63 34 /tmp/somefile.txt internalsite.corp.com
[garyd@dizzymouse iterator]$ ./iterator.py run
Mode : Run
Command : echo "Doing _THINGS_..."
Doing 63...
Doing 34...
Doing /tmp/somefile.txt...
Doing internalsite.corp.com...
Run complete. Exiting.
[garyd@dizzymouse iterator]$
```