rip out SHELL_ESCAPE define
[unix-history] / usr / src / usr.bin / apply / apply.1
CommitLineData
5e2129fc
KM
1.\" Copyright (c) 1983 Regents of the University of California.
2.\" All rights reserved. The Berkeley software License Agreement
3.\" specifies the terms and conditions for redistribution.
4.\"
e3cae795 5.\" @(#)apply.1 6.1 (Berkeley) %G%
5e2129fc 6.\"
e3cae795 7.TH APPLY 1 ""
5e2129fc
KM
8.UC 5
9.SH NAME
10apply \- apply a command to a set of arguments
11.SH SYNOPSIS
12.B apply
13[
14.B \-a\fIc\fP
15] [
16.B \-\fIn\fP
17] command args ...
18.SH DESCRIPTION
19.I Apply
20runs the named
21.I command
22on each
23argument
24.I arg
25in turn.
26Normally arguments are chosen singly; the optional number
27.I n
28specifies the number of arguments to be passed to
29.I command.
30If
31.I n
32is zero,
33.I command
34is run without arguments once for each
35.I arg.
36Character sequences of the form %\fId\fP
37in
38.I command,
39where
40.I d
41is a digit from 1 to 9,
42are replaced by the
43\fId\fP'th following unused
44.I arg.
45If any such sequences occur,
46.I n
47is ignored,
48and the number of arguments passed to
49.I command
50is the maximum value of
51.I d
52in
53.I command.
54The character `%' may be changed by the
55.B \-a
56option.
57.PP
58Examples:
59.RS
60apply echo *
61.RE
62is similar to ls(1);
63.RS
64apply \-2 cmp a1 b1 a2 b2 ...
65.RE
66compares the `a' files to the `b' files;
67.RS
68apply \-0 who 1 2 3 4 5
69.RE
70runs who(1) 5 times; and
71.RS
72apply \(aaln %1 /usr/joe\(aa *
73.RE
74links all files in the current directory to the directory /usr/joe.
75.SH "SEE ALSO"
76sh(1)
77.SH AUTHOR
78Rob Pike
79.SH BUGS
80Shell metacharacters in
81.I command
82may have bizarre effects; it is best to enclose complicated
83commands in single quotes \(aa\ \(aa.
84.sp
85There is no way to pass a literal `%2' if `%' is the
86argument expansion character.