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