NAME

apply - apply a command to a set of arguments

SYNOPSIS

apply [-ac] [-#] command argument [argument ... ]

DESCRIPTION

apply runs the named command on each argument argument.

By default, arguments are taken one at a time, and the command is executed with each argument in turn. The command is interpreted by the default shell, which may vary depending on the platform and the setting of the SHELL environment variable.

% is a magic character in the command string. If command contains a character sequence of the form %i, where i is an non-negative integer, the magic character sequence will be replaced by the i'th argument of the arguments remaining to be processed. This also indicates that each command will process at least i arguments, rather than processing and discarding them singly.

OPTIONS

-#

process # arguments per command, where # is a non-negative integer. For example, setting -3 is analogous to specifying a command string of 'command %1 %2 %3'. If # is zero, the arguments themselves will be discarded, and command will be executed once for each argument.

This option may be overridden by giving magic sequences in the command string, as described above.

-a<character>

The magic character (normally %) can be changed by setting the -a option.

ENVIRONMENT

The following environment variable affects the execution of apply:

 SHELL  Pathname of shell to use.  If this variable is 
        not defined, the Bourne shell (sh) is used.

BUGS

apply was reverse engineered, including behaviors that weren't well-defined by the manuals, for maximum compatibility. There are plenty of places where we could improve the error messages, etc.

For instance, if the environment variable SHELL is set to a_nonexistent_shell, apply simply exits without a warning or error code. Surely we can do better without breaking anything.

Hasn't been tested on non-Unix platforms.

AUTHOR

D Roland Walker, <walker@pobox.com>.

COPYRIGHT and LICENSE

This program is copyright (c) Roland Walker 1999.

This program is free and open software. You may use, modify, distribute, and sell this program (and any modified variants) in any way you wish, provided you do not restrict others from doing the same.