Annotation of src/usr.bin/apply/apply.1, Revision 1.19
1.19 ! millert 1: .\" $OpenBSD: apply.1,v 1.18 2003/03/12 20:12:37 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.
1.19 ! millert 15: .\" 3. Neither the name of the University nor the names of its contributors
1.1 deraadt 16: .\" may be used to endorse or promote products derived from this software
17: .\" without specific prior written permission.
18: .\"
19: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
20: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22: .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
23: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29: .\" SUCH DAMAGE.
30: .\"
31: .\" @(#)apply.1 8.2 (Berkeley) 4/4/94
32: .\"
33: .Dd April 4, 1994
34: .Dt APPLY 1
1.8 aaron 35: .Os
1.1 deraadt 36: .Sh NAME
37: .Nm apply
38: .Nd apply a command to a set of arguments
39: .Sh SYNOPSIS
40: .Nm apply
1.14 aaron 41: .Op Fl Ar #
42: .Op Fl a Ar magic
1.10 aaron 43: .Op Fl d
1.7 aaron 44: .Ar command argument
45: .Op Ar ...
1.1 deraadt 46: .Sh DESCRIPTION
1.9 aaron 47: .Nm
1.1 deraadt 48: runs the named
49: .Ar command
1.10 aaron 50: on each given
1.1 deraadt 51: .Ar argument
52: in turn.
53: .Pp
54: Character sequences of the form
55: .Dq Li \&%d
56: in
57: .Ar command ,
58: where
1.10 aaron 59: .Sq d
1.1 deraadt 60: is a digit from 1 to 9, are replaced by the
61: .Li d Ns \'th
62: following unused
63: .Ar argument .
64: In this case, the largest digit number of arguments are discarded for
65: each execution of
66: .Ar command .
67: .Pp
68: The options are as follows:
1.12 aaron 69: .Bl -tag -width Ds
1.1 deraadt 70: .It Fl Ns Ar #
71: Normally arguments are taken singly; the optional number
1.11 aaron 72: .Fl Ns Ar #
1.1 deraadt 73: specifies the number of arguments to be passed to
74: .Ar command .
75: If the number is zero,
76: .Ar command
77: is run, without arguments, once for each
78: .Ar argument .
79: .Pp
80: If any sequences of
81: .Dq Li \&%d
1.7 aaron 82: occur in
83: .Ar command ,
84: the
1.11 aaron 85: .Fl Ns Ar #
1.1 deraadt 86: option is ignored.
1.14 aaron 87: .It Fl a Ar magic
1.11 aaron 88: Use
1.14 aaron 89: .Ar magic
1.11 aaron 90: as the magic character instead of the default
91: .Ql % .
1.10 aaron 92: .It Fl d
93: Debug mode.
94: Print commands to the standard output but do not actually execute them.
1.1 deraadt 95: .El
96: .Sh EXAMPLES
1.18 deraadt 97: .Li "$ apply echo a*"
1.15 aaron 98: .Pp
99: Similar to
100: .Xr ls 1 .
101: .Pp
1.18 deraadt 102: .Li "$ apply \-2 cmp a1 b1 a2 b2 a3 b3"
1.15 aaron 103: .Pp
104: Compares the
105: .Dq a
1.10 aaron 106: files to the
1.15 aaron 107: .Dq b
108: files.
109: .Pp
1.18 deraadt 110: .Li "$ apply \-0 who 1 2 3 4 5"
1.15 aaron 111: .Pp
112: Runs
1.5 deraadt 113: .Xr who 1
1.15 aaron 114: 5 times.
115: .Pp
1.18 deraadt 116: .Li "$ apply \'ln %1 /usr/joe\'" *
1.15 aaron 117: .Pp
118: Links all files in the current directory to the directory
1.1 deraadt 119: .Pa /usr/joe .
1.13 aaron 120: .Sh ENVIRONMENT
121: .Bl -tag -width SHELL
122: .It Ev SHELL
123: Pathname of shell to use.
124: If this variable is not defined, the Bourne shell is used.
125: .El
1.7 aaron 126: .Sh FILES
1.1 deraadt 127: .Bl -tag -width /bin/sh -compact
128: .It Pa /bin/sh
1.7 aaron 129: default shell
1.1 deraadt 130: .El
1.10 aaron 131: .Sh SEE ALSO
132: .Xr xargs 1
1.15 aaron 133: .Sh AUTHORS
1.1 deraadt 134: Rob Pike
1.13 aaron 135: .Sh HISTORY
136: The
137: .Nm
138: command appeared in
139: .Bx 4.2 .
1.1 deraadt 140: .Sh BUGS
141: Shell metacharacters in
142: .Ar command
143: may have bizarre effects; it is best to enclose complicated
144: commands in single quotes
1.4 deraadt 145: .Pq '' .