.TH APPLY 1 .SH NAME apply \- apply a command to a set of arguments .SH SYNOPSIS .B apply [ .BI \-a c ] [ .BI \- n ] command args ... .SH DESCRIPTION .I apply runs the named .I command on each argument .I arg in turn. Normally arguments are chosen singly; the optional number .I n specifies the number of arguments to be passed to .I command. If .I n is zero, .I command is run without arguments once for each .I arg. Character sequences of the form .RI % d in .I command, where .I d is a digit from 1 to 9, are replaced by the \fId\fP'th following unused .I arg. If any such sequences occur, .I n is ignored, and the number of arguments passed to .I command is the maximum value of .I d in .I command. The character `%' may be changed by the .B \-a option. .PP .SH EXAMPLES .TP apply echo * is a time-consuming way to do `ls \-1' .TP apply \-2 cmp a1 b1 a2 b2 ... compares the `a' files to the `b' files .TP apply \-0 date \`seq 20\` runs .I date 20 times; like `for i in \`seq 20\`; do date; done' .SH "SEE ALSO" sh(1) .SH BUGS Shell metacharacters in .I command may have bizarre effects; it is best to enclose complicated commands in single quotes \(aa\ \(aa. .br There is no way to pass a literal `%2' if `%' is the argument expansion character.