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