|
|
1.1 root 1: .\" Copyright (c) 1983, 1990 The Regents of the University of California.
2: .\" All rights reserved.
3: .\"
4: .\"
5: .\" @(#)apply.1 6.3 (Berkeley) 7/24/90
6: .\"
7: .Dd July 24, 1990
8: .Dt APPLY 1
9: .Os BSD 4.2
10: .Sh NAME
11: .Nm apply
12: .Nd apply a command to a set of arguments
13: .Sh SYNOPSIS
14: .Nm apply
15: .Op Fl ac
16: .Op Fl n
17: .Ar command args ...
18: .Sh DESCRIPTION
19: .Nm Apply
20: runs the named
21: .Ar command
22: on each
23: argument
24: .Ar arg
25: in turn.
26: Normally arguments are chosen singly; the optional number
27: .Fl n
28: specifies the number of arguments to be passed to
29: .Ar command .
30: If
31: .Fl n
32: is zero,
33: .Ar command
34: is run without arguments once for each
35: .Ar arg
36: Character sequences of the form
37: .Cx %
38: .Ar d
39: .Cx
40: in
41: .Ar command ,
42: where
43: .Ar d
44: is a digit from 1 to 9,
45: are replaced by the
46: .Ar d\'th
47: following unused
48: .Ar arg .
49: If any such sequences occur,
50: .Fl n
51: is ignored,
52: and the number of arguments passed to
53: .Ar command
54: is the maximum value of
55: .Ar d
56: in
57: .Ar command .
58: The character `%' may be changed by the
59: .Fl a
60: option.
61: .SH ENVIRONMENT
62: .Nm apply
63: checks the environment variable
64: .Ev SHELL
65: to find out which shell to use.
66: .Sh EXAMPLES
67: .Ds
68: .Tw apply \-2 cmp a1 b1 a2 b2 ...
69: .Tp Li apply echo a*
70: is similar to ls(1);
71: .Tp Li apply \-2 cmp a1 b1 a2 b2 ...
72: compares the `a' files to the `b' files;
73: .Tp Li apply \-0 who 1 2 3 4 5
74: runs who(1) 5 times; and
75: .Tp Li apply \(aaln %1 /usr/joe\(aa *
76: links all files in the current directory to the directory
77: .Pa /usr/joe .
78: .Tp
79: .De
80: .Sh SEE ALSO
81: .Xr sh 1
82: .Sh HISTORY
83: .Nm Apply
84: appeared in 4.2BSD.
85: .Sh AUTHOR
86: Rob Pike
87: .Sh BUGS
88: Shell metacharacters in
89: .Ar command
90: may have bizarre effects; it is best to enclose complicated
91: commands in single quotes (\(aa\ \(aa).
92: .Pp
93: There is no way to pass a literal `%2' if `%' is the
94: argument expansion character.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.