Annotation of src/usr.bin/apply/apply.1, Revision 1.3
1.3 ! deraadt 1: .\" $OpenBSD: apply.1,v 1.4 1996/03/18 23:16:57 jtc Exp $
1.2 deraadt 2: .\" $NetBSD: apply.1,v 1.4 1996/03/18 23:16:57 jtc Exp $
1.1 deraadt 3: .\"
4: .\" Copyright (c) 1983, 1990, 1993
5: .\" The Regents of the University of California. All rights reserved.
6: .\"
7: .\" Redistribution and use in source and binary forms, with or without
8: .\" modification, are permitted provided that the following conditions
9: .\" are met:
10: .\" 1. Redistributions of source code must retain the above copyright
11: .\" notice, this list of conditions and the following disclaimer.
12: .\" 2. Redistributions in binary form must reproduce the above copyright
13: .\" notice, this list of conditions and the following disclaimer in the
14: .\" documentation and/or other materials provided with the distribution.
15: .\" 3. All advertising materials mentioning features or use of this software
16: .\" must display the following acknowledgement:
17: .\" This product includes software developed by the University of
18: .\" California, Berkeley and its contributors.
19: .\" 4. Neither the name of the University nor the names of its contributors
20: .\" may be used to endorse or promote products derived from this software
21: .\" without specific prior written permission.
22: .\"
23: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26: .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33: .\" SUCH DAMAGE.
34: .\"
35: .\" @(#)apply.1 8.2 (Berkeley) 4/4/94
36: .\"
37: .Dd April 4, 1994
38: .Dt APPLY 1
39: .Os BSD 4.2
40: .Sh NAME
41: .Nm apply
42: .Nd apply a command to a set of arguments
43: .Sh SYNOPSIS
44: .Nm apply
45: .Op Fl a Ns Ar c
46: .Op Fl Ns Ar #
47: .Ar command argument ...
48: .Sh DESCRIPTION
49: .Nm Apply
50: runs the named
51: .Ar command
52: on each
53: argument
54: .Ar argument
55: in turn.
56: .Pp
57: Character sequences of the form
58: .Dq Li \&%d
59: in
60: .Ar command ,
61: where
62: .Dq Li d
63: is a digit from 1 to 9, are replaced by the
64: .Li d Ns \'th
65: following unused
66: .Ar argument .
67: In this case, the largest digit number of arguments are discarded for
68: each execution of
69: .Ar command .
70: .Pp
71: The options are as follows:
72: .Bl -tag -width "-ac"
73: .It Fl Ns Ar #
74: Normally arguments are taken singly; the optional number
75: .Fl #
76: specifies the number of arguments to be passed to
77: .Ar command .
78: If the number is zero,
79: .Ar command
80: is run, without arguments, once for each
81: .Ar argument .
82: .Pp
83: If any sequences of
84: .Dq Li \&%d
85: occur in command, the
1.2 deraadt 86: .Fl #
1.1 deraadt 87: option is ignored.
88: .It Fl a Ns Ar c
89: The use of the character
90: .Dq Li %
91: as a magic character may be changed with the
92: .Fl a
93: option.
94: .El
95: .Sh ENVIRONMENT VARIABLES
96: The following environment variable affects the execution of
97: .Nm apply :
98: .Bl -tag -width SHELL
99: .It Ev SHELL
100: Pathname of shell to use.
101: If this variable is not defined, the Bourne shell is used.
102: .El
103: .Sh EXAMPLES
104: .Bl -tag -width apply -compact
105: .It Li "apply echo a*"
106: is similar to ls(1);
107: .It Li "apply \-2 cmp a1 b1 a2 b2 a3 b3"
108: compares the `a' files to the `b' files;
109: .It Li "apply \-0 who 1 2 3 4 5"
110: runs who(1) 5 times; and
111: .It Li "apply \'ln %1 /usr/joe\'" *
112: links all files in the current directory to the directory
113: .Pa /usr/joe .
114: .El
115: .Sh Files
116: .Bl -tag -width /bin/sh -compact
117: .It Pa /bin/sh
118: Default shell
119: .El
120: .Sh AUTHOR
121: Rob Pike
122: .Sh BUGS
123: Shell metacharacters in
124: .Ar command
125: may have bizarre effects; it is best to enclose complicated
126: commands in single quotes
127: .Pq Sq .
128: .Sh HISTORY
129: The
130: .Nm
131: command appeared in
132: .Bx 4.2 .