Annotation of src/usr.bin/apply/apply.1, Revision 1.7
1.7 ! aaron 1: .\" $OpenBSD: apply.1,v 1.6 1998/05/13 10:33:24 deraadt 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 #
1.7 ! aaron 47: .Ar command argument
! 48: .Op Ar ...
1.1 deraadt 49: .Sh DESCRIPTION
1.7 ! aaron 50: .Nm apply
1.1 deraadt 51: runs the named
52: .Ar command
53: on each
54: argument
55: .Ar argument
56: in turn.
57: .Pp
58: Character sequences of the form
59: .Dq Li \&%d
60: in
61: .Ar command ,
62: where
1.7 ! aaron 63: .Sq Li d
1.1 deraadt 64: is a digit from 1 to 9, are replaced by the
65: .Li d Ns \'th
66: following unused
67: .Ar argument .
68: In this case, the largest digit number of arguments are discarded for
69: each execution of
70: .Ar command .
71: .Pp
72: The options are as follows:
73: .Bl -tag -width "-ac"
74: .It Fl Ns Ar #
75: Normally arguments are taken singly; the optional number
76: .Fl #
77: specifies the number of arguments to be passed to
78: .Ar command .
79: If the number is zero,
80: .Ar command
81: is run, without arguments, once for each
82: .Ar argument .
83: .Pp
84: If any sequences of
85: .Dq Li \&%d
1.7 ! aaron 86: occur in
! 87: .Ar command ,
! 88: the
1.2 deraadt 89: .Fl #
1.1 deraadt 90: option is ignored.
91: .It Fl a Ns Ar c
92: The use of the character
1.7 ! aaron 93: .Sq Li %
1.1 deraadt 94: as a magic character may be changed with the
95: .Fl a
96: option.
97: .El
1.6 deraadt 98: .Sh ENVIRONMENT
1.1 deraadt 99: The following environment variable affects the execution of
100: .Nm apply :
101: .Bl -tag -width SHELL
102: .It Ev SHELL
103: Pathname of shell to use.
104: If this variable is not defined, the Bourne shell is used.
105: .El
106: .Sh EXAMPLES
107: .Bl -tag -width apply -compact
108: .It Li "apply echo a*"
1.5 deraadt 109: is similar to
110: .Xr ls 1 ;
1.1 deraadt 111: .It Li "apply \-2 cmp a1 b1 a2 b2 a3 b3"
112: compares the `a' files to the `b' files;
113: .It Li "apply \-0 who 1 2 3 4 5"
1.5 deraadt 114: runs
115: .Xr who 1
116: 5 times; and
1.1 deraadt 117: .It Li "apply \'ln %1 /usr/joe\'" *
118: links all files in the current directory to the directory
119: .Pa /usr/joe .
120: .El
1.7 ! aaron 121: .Sh FILES
1.1 deraadt 122: .Bl -tag -width /bin/sh -compact
123: .It Pa /bin/sh
1.7 ! aaron 124: default shell
1.1 deraadt 125: .El
126: .Sh AUTHOR
127: Rob Pike
128: .Sh BUGS
129: Shell metacharacters in
130: .Ar command
131: may have bizarre effects; it is best to enclose complicated
132: commands in single quotes
1.4 deraadt 133: .Pq '' .
1.1 deraadt 134: .Sh HISTORY
135: The
136: .Nm
137: command appeared in
138: .Bx 4.2 .