Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ apply(1) — A/UX 3.0.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

csh(1)

ksh(1)

sh(1)

xargs(1)




apply(1) apply(1)
NAME apply - passes its arguments in batches to a command that is run once per every batch SYNOPSIS apply [-aesc-char] [-args-per-batch] command argument... ARGUMENTS -aesc-char Specifies the escape character that can change the interpretation of argument. The default is the percent sign (%). See the ``Description'' section for information about how the argument selector works. argument Specifies an argument to be passed to command. You should specify a multiple of the number of arguments that are needed to run command successfully once. command Specifies the command that apply is to run. -args-per-batch Specifies the number of arguments to pass from the apply command line to command each time apply runs the command. If you do not use this option, apply passes one argument at a time. If the value of args-per-batch is 0, apply runs command once for each arg but does not pass arg to command. DESCRIPTION apply runs a command enough times to use up the arguments specified on the apply command line. An argument-selector is part of a command and has the form %d, where d is a digit from 1 to 9. The apply command replaces the argument-selector with the next digit argument and runs the command. If an argument-selector is present in command, apply ignores the -args-per-batch option, if provided. To avoid an error message when the arguments are exhausted, you need to make the number of arguments on the apply command line a multiple of d. See the third example in the next section for a way to use an argument-selector. EXAMPLES The first example of the apply command uses cmp to compare the a files to the b files. The -2 option causes apply to take arguments in sets of two from the apply command line and use them to run cmp until the arguments are exhausted. apply -2 cmp a1 b1 a2 b2 January 1992 1



apply(1) apply(1)
The second example shows what happens when the -n option is set to 0. Five arguments appear after the who command, so apply runs the who command five times, but it does not pass the arguments to who because n is 0. apply -0 who a 2 c 4 e The third example shows the use of an argument-selector. This command creates a link in the directory /usr/mcfong between each file in the current directory: apply 'ln %1 /usr/mcfong' * If the argument-selector were %3, the apply command would run ln for every third filename expanded by the shell. If the total number of expanded filenames were not a multiple of 3, apply would run ln for every third filename and display an error message when it could not get the next argument that is a multiple of 3. LIMITATIONS Shell metacharacters in command may have bizarre effects. You should enclose complicated commands in single quotation marks ('). You cannot pass a literal %2 if % is the argument-selector character. FILES /usr/ucb/apply Executable file SEE ALSO csh(1), ksh(1), sh(1), xargs(1) 2 January 1992

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026