[BACK]Return to apply.1 CVS log [TXT][DIR] Up to [local] / src / usr.bin / apply

Annotation of src/usr.bin/apply/apply.1, Revision 1.23

1.23    ! jmc         1: .\"    $OpenBSD: apply.1,v 1.22 2006/12/14 09:41:32 jmc 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: .\"
1.23    ! jmc        33: .Dd $Mdocdate$
1.1       deraadt    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 #
1.21      jaredy     42: .Op Fl d
1.14      aaron      43: .Op Fl a Ar magic
1.21      jaredy     44: .Ar command argument ...
1.1       deraadt    45: .Sh DESCRIPTION
1.9       aaron      46: .Nm
1.1       deraadt    47: runs the named
                     48: .Ar command
1.10      aaron      49: on each given
1.1       deraadt    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
1.10      aaron      58: .Sq d
1.1       deraadt    59: is a digit from 1 to 9, are replaced by the
1.21      jaredy     60: .Li d Ns 'th
1.1       deraadt    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:
1.12      aaron      68: .Bl -tag -width Ds
1.1       deraadt    69: .It Fl Ns Ar #
                     70: Normally arguments are taken singly; the optional number
1.11      aaron      71: .Fl Ns Ar #
1.1       deraadt    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
1.7       aaron      81: occur in
                     82: .Ar command ,
                     83: the
1.11      aaron      84: .Fl Ns Ar #
1.1       deraadt    85: option is ignored.
1.14      aaron      86: .It Fl a Ar magic
1.11      aaron      87: Use
1.14      aaron      88: .Ar magic
1.11      aaron      89: as the magic character instead of the default
                     90: .Ql % .
1.10      aaron      91: .It Fl d
                     92: Debug mode.
                     93: Print commands to the standard output but do not actually execute them.
1.1       deraadt    94: .El
1.20      jmc        95: .Sh ENVIRONMENT
                     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
1.1       deraadt   106: .Sh EXAMPLES
1.21      jaredy    107: Operate similar to
                    108: .Xr ls 1 :
1.15      aaron     109: .Pp
1.22      jmc       110: .Dl "$ apply echo *"
1.15      aaron     111: .Pp
1.21      jaredy    112: Compare the
                    113: .Pa a*
1.10      aaron     114: files to the
1.21      jaredy    115: .Pa b*
                    116: files:
1.15      aaron     117: .Pp
1.21      jaredy    118: .Dl "$ apply -2 cmp a1 b1 a2 b2 a3 b3"
1.15      aaron     119: .Pp
1.21      jaredy    120: Run
1.5       deraadt   121: .Xr who 1
1.21      jaredy    122: five times:
                    123: .Pp
                    124: .Dl "$ apply -0 who 1 2 3 4 5"
1.15      aaron     125: .Pp
1.21      jaredy    126: Link all files in the current directory to the directory
                    127: .Pa /home/joe :
1.15      aaron     128: .Pp
1.21      jaredy    129: .Dl "$ apply 'ln %1 /home/joe'" *
1.10      aaron     130: .Sh SEE ALSO
1.21      jaredy    131: .Xr sh 1 ,
1.10      aaron     132: .Xr xargs 1
1.13      aaron     133: .Sh HISTORY
                    134: The
                    135: .Nm
                    136: command appeared in
                    137: .Bx 4.2 .
1.20      jmc       138: .Sh AUTHORS
                    139: Rob Pike
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 '' .