]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.bin/apply/apply.1
zfs: merge openzfs/zfs@dbda45160
[FreeBSD/FreeBSD.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 .\" 3. 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 .Dd January 28, 2022
29 .Dt APPLY 1
30 .Os
31 .Sh NAME
32 .Nm apply
33 .Nd apply a command to a set of arguments
34 .Sh SYNOPSIS
35 .Nm
36 .Op Fl a Ar c
37 .Op Fl d
38 .Op Cm - Ns Ar #
39 .Ar command argument ...
40 .Sh DESCRIPTION
41 The
42 .Nm
43 utility runs the named
44 .Ar command
45 on each
46 argument
47 .Ar argument
48 in turn.
49 .Pp
50 Character sequences of the form
51 .Dq Li \&%d
52 in
53 .Ar command ,
54 where
55 .Sq Li d
56 is a digit from 1 to 9, are replaced by the
57 .Li d Ns \'th
58 following unused
59 .Ar argument .
60 In this case, the largest digit number of arguments are discarded for
61 each execution of
62 .Ar command .
63 .Pp
64 The options are as follows:
65 .Bl -tag -width indent
66 .It Cm - Ns Ar #
67 Normally arguments are taken singly; the optional number
68 .Ar #
69 specifies the number of arguments to be passed to
70 .Ar command .
71 If the number is zero,
72 .Ar command
73 is run, without arguments, once for each
74 .Ar argument .
75 .Pp
76 If any sequences of
77 .Dq Li \&%d
78 occur in
79 .Ar command ,
80 the
81 .Fl #
82 option is ignored.
83 .It Fl a Ar c
84 The use of the character
85 .Sq Li %
86 as a magic character may be changed with the
87 .Fl a
88 option.
89 .It Fl d
90 Display the commands that would have been executed, but do not actually
91 execute them.
92 .El
93 .Sh ENVIRONMENT
94 The following environment variable affects the execution of
95 .Nm :
96 .Bl -tag -width SHELL
97 .It Ev SHELL
98 Pathname of shell to use.
99 If this variable is not defined, the Bourne shell is used.
100 .El
101 .Sh FILES
102 .Bl -tag -width /bin/sh -compact
103 .It Pa /bin/sh
104 default shell
105 .El
106 .Sh EXAMPLES
107 .Bl -tag -width apply -compact
108 .It Li "apply echo *"
109 is similar to
110 .Xr ls 1 ;
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"
114 runs
115 .Xr who 1
116 5 times; and
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
121 .Sh HISTORY
122 The
123 .Nm
124 command appeared in
125 .Bx 4.2 .
126 .Sh AUTHORS
127 .An 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
133 .Pq '' .
134 .Pp
135 The
136 .Nm
137 utility does not recognize multibyte characters.