Annotation of src/usr.bin/apply/apply.1, Revision 1.18
1.18 ! deraadt 1: .\" $OpenBSD: apply.1,v 1.17 2002/02/13 08:33:46 mpech 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
1.8 aaron 39: .Os
1.1 deraadt 40: .Sh NAME
41: .Nm apply
42: .Nd apply a command to a set of arguments
43: .Sh SYNOPSIS
44: .Nm apply
1.14 aaron 45: .Op Fl Ar #
46: .Op Fl a Ar magic
1.10 aaron 47: .Op Fl d
1.7 aaron 48: .Ar command argument
49: .Op Ar ...
1.1 deraadt 50: .Sh DESCRIPTION
1.9 aaron 51: .Nm
1.1 deraadt 52: runs the named
53: .Ar command
1.10 aaron 54: on each given
1.1 deraadt 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.10 aaron 63: .Sq 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:
1.12 aaron 73: .Bl -tag -width Ds
1.1 deraadt 74: .It Fl Ns Ar #
75: Normally arguments are taken singly; the optional number
1.11 aaron 76: .Fl Ns Ar #
1.1 deraadt 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.11 aaron 89: .Fl Ns Ar #
1.1 deraadt 90: option is ignored.
1.14 aaron 91: .It Fl a Ar magic
1.11 aaron 92: Use
1.14 aaron 93: .Ar magic
1.11 aaron 94: as the magic character instead of the default
95: .Ql % .
1.10 aaron 96: .It Fl d
97: Debug mode.
98: Print commands to the standard output but do not actually execute them.
1.1 deraadt 99: .El
100: .Sh EXAMPLES
1.18 ! deraadt 101: .Li "$ apply echo a*"
1.15 aaron 102: .Pp
103: Similar to
104: .Xr ls 1 .
105: .Pp
1.18 ! deraadt 106: .Li "$ apply \-2 cmp a1 b1 a2 b2 a3 b3"
1.15 aaron 107: .Pp
108: Compares the
109: .Dq a
1.10 aaron 110: files to the
1.15 aaron 111: .Dq b
112: files.
113: .Pp
1.18 ! deraadt 114: .Li "$ apply \-0 who 1 2 3 4 5"
1.15 aaron 115: .Pp
116: Runs
1.5 deraadt 117: .Xr who 1
1.15 aaron 118: 5 times.
119: .Pp
1.18 ! deraadt 120: .Li "$ apply \'ln %1 /usr/joe\'" *
1.15 aaron 121: .Pp
122: Links all files in the current directory to the directory
1.1 deraadt 123: .Pa /usr/joe .
1.13 aaron 124: .Sh ENVIRONMENT
125: .Bl -tag -width SHELL
126: .It Ev SHELL
127: Pathname of shell to use.
128: If this variable is not defined, the Bourne shell is used.
129: .El
1.7 aaron 130: .Sh FILES
1.1 deraadt 131: .Bl -tag -width /bin/sh -compact
132: .It Pa /bin/sh
1.7 aaron 133: default shell
1.1 deraadt 134: .El
1.10 aaron 135: .Sh SEE ALSO
136: .Xr xargs 1
1.15 aaron 137: .Sh AUTHORS
1.1 deraadt 138: Rob Pike
1.13 aaron 139: .Sh HISTORY
140: The
141: .Nm
142: command appeared in
143: .Bx 4.2 .
1.1 deraadt 144: .Sh BUGS
145: Shell metacharacters in
146: .Ar command
147: may have bizarre effects; it is best to enclose complicated
148: commands in single quotes
1.4 deraadt 149: .Pq '' .