Annotation of src/usr.bin/apply/apply.1, Revision 1.10
1.10 ! aaron 1: .\" $OpenBSD: apply.1,v 1.9 1999/07/04 11:53:50 aaron 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
45: .Op Fl a Ns Ar c
46: .Op Fl Ns Ar #
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:
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.10 ! aaron 93: .Ql %
1.1 deraadt 94: as a magic character may be changed with the
95: .Fl a
96: option.
1.10 ! aaron 97: .It Fl d
! 98: Debug mode.
! 99: Print commands to the standard output but do not actually execute them.
1.1 deraadt 100: .El
1.6 deraadt 101: .Sh ENVIRONMENT
1.1 deraadt 102: The following environment variable affects the execution of
103: .Nm apply :
104: .Bl -tag -width SHELL
105: .It Ev SHELL
106: Pathname of shell to use.
107: If this variable is not defined, the Bourne shell is used.
108: .El
109: .Sh EXAMPLES
110: .Bl -tag -width apply -compact
111: .It Li "apply echo a*"
1.5 deraadt 112: is similar to
113: .Xr ls 1 ;
1.1 deraadt 114: .It Li "apply \-2 cmp a1 b1 a2 b2 a3 b3"
1.10 ! aaron 115: compares the
! 116: .Sq a
! 117: files to the
! 118: .Sq b files;
1.1 deraadt 119: .It Li "apply \-0 who 1 2 3 4 5"
1.5 deraadt 120: runs
121: .Xr who 1
122: 5 times; and
1.1 deraadt 123: .It Li "apply \'ln %1 /usr/joe\'" *
124: links all files in the current directory to the directory
125: .Pa /usr/joe .
126: .El
1.7 aaron 127: .Sh FILES
1.1 deraadt 128: .Bl -tag -width /bin/sh -compact
129: .It Pa /bin/sh
1.7 aaron 130: default shell
1.1 deraadt 131: .El
1.10 ! aaron 132: .Sh SEE ALSO
! 133: .Xr xargs 1
1.1 deraadt 134: .Sh AUTHOR
135: Rob Pike
136: .Sh BUGS
137: Shell metacharacters in
138: .Ar command
139: may have bizarre effects; it is best to enclose complicated
140: commands in single quotes
1.4 deraadt 141: .Pq '' .
1.1 deraadt 142: .Sh HISTORY
143: The
144: .Nm
1.8 aaron 145: command appeared in
1.1 deraadt 146: .Bx 4.2 .