-
Notifications
You must be signed in to change notification settings - Fork 1
/
command-help.pd
217 lines (217 loc) · 7.38 KB
/
command-help.pd
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
#N canvas 243 26 803 701 10;
#N canvas 479 242 468 230 META 0;
#X text 12 45 INLET_0 anything;
#X text 12 65 OUTLET_0 anything;
#X text 12 5 KEYWORDS control command system;
#X text 12 25 DESCRIPTION run commands;
#X text 12 85 OUTLET_1 anything;
#X text 12 105 OUTLET_2 anything;
#X restore 741 667 pd META;
#X obj 1 1 cnv 15 800 30 empty empty empty 20 12 0 14 #e0e0e0 #404040 0;
#X text 12 7 command - execute commands or scripts from Pd;
#X msg 14 70 exec ls;
#X obj 14 148 command;
#X text 81 71 exec method invokes comand;
#X msg 25 97 exec ls -lh command-help.pd;
#X msg 36 123 exec ls -lh nosuchfile;
#X obj 14 338 command;
#X msg 14 280 exec sleep 5;
#X msg 61 306 kill;
#X text 98 306 and can be interrupted;
#X obj 394 188 command;
#X msg 394 67 exec telnet netpd.org 80;
#X msg 416 161 send GET /index.html HTTP/1.0\$1Hostname: netpd.org\$1\$1;
#X obj 416 137 list tosymbol;
#X msg 416 114 10;
#X obj 416 93 bng 15 250 50 0 empty empty empty 17 7 0 10 #fcfcfc #000000 #000000;
#X text 501 136 <- newline;
#X text 12 46 exec - execute command;
#X text 11 253 kill - kill currently running command;
#X text 374 42 send - send something to stdin of command;
#X text 370 90 2) -->;
#X text 370 67 1);
#X obj 394 474 command;
#X obj 413 497 print PWD_STDOUT;
#X msg 394 451 exec pwd;
#X obj 14 221 print LS_EXIT;
#X obj 33 197 print LS_STDOUT;
#X obj 53 173 print LS_STDERR;
#X obj 14 411 print SLEEP_EXIT;
#X obj 33 387 print SLEEP_STDOUT;
#X obj 53 363 print SLEEP_STDERR;
#X obj 394 261 print TELNET_EXIT;
#X obj 413 237 print TELNET_STDOUT;
#X obj 433 213 print TELNET_STDERR;
#X obj 16 493 command -b;
#X obj 44 519 print BIN_STDOUT;
#X msg 16 470 exec echo -n abc d;
#X text 95 282 commands are not blocking;
#X text 14 445 -b - binary output for bypassing FUDI parsing;
#X text 392 617 outlet0: exit code;
#X text 392 637 outlet1: stdout;
#X text 392 657 outlet2: stderr;
#X text 392 534 SYNOPSIS:;
#X text 391 557 flags:;
#X text 409 577 -b: binary output (optional);
#N canvas 524 26 873 777 more 0;
#X text 13 7 Breaking order of execution;
#X text 13 17 ---------------------------;
#X text 13 37 The non-blocking nature of [command] breaks order of execution. Something like this gives unexpected results:;
#X obj 44 149 command;
#X obj 17 171 f;
#X obj 17 102 t b a;
#X msg 44 125 exec bash -c echo\\\ $((5+\$1));
#X floatatom 17 195 5 0 0 0 - - - 0;
#X obj 19 303 command, f 15;
#X obj 19 350 f, f 7;
#X msg 19 279 exec bash -c echo\\\ $((5+\$1));
#X floatatom 19 375 5 0 0 0 - - - 0;
#X obj 19 327 sel 0;
#X text 16 231 This gives always the correct result:;
#X text 17 422 One command at the time;
#X text 17 432 -----------------------;
#X msg 19 251 5;
#X msg 53 251 17;
#X msg 83 251 0;
#X msg 17 77 5;
#X msg 51 77 17;
#X msg 81 77 0;
#X text 161 103 5 + x;
#X text 146 260 5 + x;
#X obj 20 529 command;
#X obj 20 552 print EXIT;
#X msg 20 506 exec sleep 0.5 \, exec ls non-existing-file;
#X text 17 451 [command] runs exactly one command at the time. Executing another command while the current is still running triggers an error and the new command is ignored:;
#X text 19 581 Make sure to wait for the exit code to be reported before executing another command.;
#X obj 20 674 command;
#X obj 20 737 print EXIT;
#X obj 86 552 print STDERR;
#X obj 86 737 print STDERR;
#X obj 20 705 t a a;
#X obj 113 655 sel 0;
#X msg 113 681 exec ls non-existing-file;
#X msg 20 625 exec sleep 0.5;
#X obj 440 109 command;
#X obj 440 142 print EXIT;
#X obj 506 142 print STDERR;
#X text 437 7 No shell expansion;
#X text 437 17 ------------------;
#X text 57 194 <- result from previous execution;
#X text 57 378 <- expected result;
#X text 168 552 <- stderr is quiet;
#X text 165 737 <- we get error from 'ls' command;
#X text 699 74 <- quotes are not parsed;
#X text 499 99 is interpreted as:;
#X text 438 174 However \, this works:;
#X text 437 35 [command] executes raw commands and does not invoke a shell to run commands. Typical shell features are not available.;
#X obj 440 229 command;
#X obj 440 262 print EXIT;
#X obj 506 262 print STDERR;
#X msg 440 76 exec python3 -c "import sys\\\; sys.exit(4)";
#X msg 440 196 exec python3 -c import\\\ sys\\\;\\\ sys.exit(4), f 44;
#X text 509 218 spaces within a command arg need to be escaped.;
#X text 510 236 semicolons need to be escaped in message boxes.;
#X text 437 398 Preserve exact output;
#X text 437 408 ---------------------;
#X msg 440 554 exec date +%Y%m%d%H%M%S;
#X obj 440 577 command;
#X floatatom 459 601 14 0 0 0 - - - 0;
#X msg 441 659 exec date +%Y%m%d%H%M%S;
#X obj 441 682 command -b;
#X symbolatom 469 733 16 0 0 0 - - - 0;
#X obj 469 708 list tosymbol;
#X text 440 516 Number is too big for keeping all digits intact in Pd's float format:;
#X text 572 733 <- cannot be used for calculations;
#X text 440 636 As a symbol \, all digits are kept intact:;
#X obj 440 345 command;
#X msg 440 322 exec bash -c echo\\\ $HOME;
#X obj 459 367 print $HOME;
#X text 439 288 You can still use shell features by wrapping the command into a shell:;
#X text 437 424 By default \, stdout and stderr are FUDI parsed: output is split into lists at spaces \, while numeric values are converted to floats and other values to symbols. If this automatic conversion is not desired \, the -b option is used to output the results as a list of bytes. This keeps the original representation intact.;
#X text 518 117 'python3' '-c' '"import' 'sys\\\; ' 'sys.exit(4)"';
#X connect 3 1 4 1;
#X connect 4 0 7 0;
#X connect 5 0 4 0;
#X connect 5 1 6 0;
#X connect 6 0 3 0;
#X connect 8 0 12 0;
#X connect 8 1 9 1;
#X connect 9 0 11 0;
#X connect 10 0 8 0;
#X connect 12 0 9 0;
#X connect 16 0 10 0;
#X connect 17 0 10 0;
#X connect 18 0 10 0;
#X connect 19 0 5 0;
#X connect 20 0 5 0;
#X connect 21 0 5 0;
#X connect 24 0 25 0;
#X connect 24 2 31 0;
#X connect 26 0 24 0;
#X connect 29 0 33 0;
#X connect 29 2 32 0;
#X connect 33 0 34 0;
#X connect 33 1 30 0;
#X connect 34 0 35 0;
#X connect 35 0 29 0;
#X connect 36 0 29 0;
#X connect 37 0 38 0;
#X connect 37 2 39 0;
#X connect 50 0 51 0;
#X connect 50 2 52 0;
#X connect 53 0 37 0;
#X connect 54 0 50 0;
#X connect 59 0 60 0;
#X connect 60 1 61 0;
#X connect 62 0 63 0;
#X connect 63 1 65 0;
#X connect 65 0 64 0;
#X connect 69 1 71 0;
#X connect 70 0 69 0;
#X restore 635 550 pd more usage information;
#X text 14 545 -s - synchronous (blocking) operation;
#X msg 64 587 exec date;
#X obj 16 635 print SYNC;
#X obj 16 595 t b b;
#X obj 16 571 bng 18 250 50 0 empty empty empty 0 -9 0 10 #fcfcfc #000000 #000000;
#X obj 64 610 command -s;
#X text 409 597 -s: synchronous operation (optional);
#X obj 394 370 command;
#X msg 498 320 exec env;
#X msg 394 320 env PDDESC cool;
#X text 376 430 working directory is directory of patch;
#X text 377 295 env - set environment variables;
#X obj 413 396 print ENV_STDOUT;
#X msg 455 345 exec sh -c echo\\\ $PDDESC;
#X connect 3 0 4 0;
#X connect 4 0 27 0;
#X connect 4 1 28 0;
#X connect 4 2 29 0;
#X connect 6 0 4 0;
#X connect 7 0 4 0;
#X connect 8 0 30 0;
#X connect 8 1 31 0;
#X connect 8 2 32 0;
#X connect 9 0 8 0;
#X connect 10 0 8 0;
#X connect 12 0 33 0;
#X connect 12 1 34 0;
#X connect 12 2 35 0;
#X connect 13 0 12 0;
#X connect 14 0 12 0;
#X connect 15 0 14 0;
#X connect 16 0 15 0;
#X connect 17 0 16 0;
#X connect 24 1 25 0;
#X connect 26 0 24 0;
#X connect 36 1 37 0;
#X connect 38 0 36 0;
#X connect 49 0 53 0;
#X connect 51 0 50 0;
#X connect 51 1 49 0;
#X connect 52 0 51 0;
#X connect 53 1 50 0;
#X connect 55 1 60 0;
#X connect 56 0 55 0;
#X connect 57 0 55 0;
#X connect 61 0 55 0;