Commit | Line | Data |
---|---|---|
11a514e8 C |
1 | .TH APPLY 1 "24 February 1979" |
2 | .SH NAME | |
3 | apply \- apply a command to a set of arguments | |
4 | .SH SYNOPSIS | |
5 | .B apply | |
6 | [ | |
7 | .B \-a\fIc\fP | |
8 | ] [ | |
9 | .B \-\fIn\fP | |
10 | ] command args ... | |
11 | .SH DESCRIPTION | |
12 | .I Apply | |
13 | runs the named | |
14 | .I command | |
15 | on each | |
16 | argument | |
17 | .I arg | |
18 | in turn. | |
19 | Normally arguments are chosen singly; the optional number | |
20 | .I n | |
21 | specifies the number of arguments to be passed to | |
22 | .I command. | |
23 | If | |
24 | .I n | |
25 | is zero, | |
26 | .I command | |
27 | is run without arguments once for each | |
28 | .I arg. | |
29 | Character sequences of the form %\fId\fP | |
30 | in | |
31 | .I command, | |
32 | where | |
33 | .I d | |
34 | is a digit from 1 to 9, | |
35 | are replaced by the | |
36 | \fId\fP'th following unused | |
37 | .I arg. | |
38 | If any such sequences occur, | |
39 | .I n | |
40 | is ignored, | |
41 | and the number of arguments passed to | |
42 | .I command | |
43 | is the maximum value of | |
44 | .I d | |
45 | in | |
46 | .I command. | |
47 | The character `%' may be changed by the | |
48 | .B \-a | |
49 | option. | |
50 | .PP | |
51 | Examples: | |
52 | .RS | |
53 | apply echo * | |
54 | .RE | |
55 | is similar to ls(1); | |
56 | .RS | |
57 | apply \-2 cmp a1 b1 a2 b2 ... | |
58 | .RE | |
59 | compares the `a' files to the `b' files; | |
60 | .RS | |
61 | apply \-0 who 1 2 3 4 5 | |
62 | .RE | |
63 | runs who(1) 5 times; and | |
64 | .RS | |
65 | apply \(aaln %1 /usr/joe\(aa * | |
66 | .RE | |
67 | links all files in the current directory to the directory /usr/joe. | |
68 | .SH "SEE ALSO" | |
69 | sh(1) | |
70 | .SH AUTHOR | |
71 | Rob Pike | |
72 | .SH BUGS | |
73 | Shell metacharacters in | |
74 | .I command | |
75 | may have bizarre effects; it is best to enclose complicated | |
76 | commands in single quotes \(aa\ \(aa. | |
77 | .sp | |
78 | There is no way to pass a literal `%2' if `%' is the | |
79 | argument expansion character. |