Applies a command to a set of parameters.
apply [ -aCharacter ] [ -Number ] CommandString Parameter ...
The apply command runs a command string specified by the CommandString parameter on each specified value of the Parameter parameter in turn. Normally, Parameter values are chosen individually; the optional -Number flag specifies the number of Parameter values to be passed to the specified command string. If the value of the Number variable is 0, the command string is run without parameters once for each Parameter value.
If you include character sequences of the form %n (where n is a digit from 1 to 9) in CommandString, they are replaced by the nth unused Parameter value following the CommandString parameter when the command string is executed. If any such sequences occur, the apply command ignores the -Number flag, and the number of parameters passed to CommandString is the maximum value of n in the CommandString parameter.
You can specify a character other than % (percent sign) to designate parameter substitution character strings with the -a flag; for example, -a@ would indicate that the sequences @1 and @2 would be replaced by the first and second unused parameters following the CommandString parameter.
Notes:
-aCharacter | Specifies a character (other than %) to designate parameter substitution strings. |
-Number | Specifies the number of parameters to be passed to CommandString each time it is run. |
apply echo *
apply -2 cmp a1 b1 a2 b2
apply -0 who 1 2 3 4 5
apply 'ln %1 /usr/joe' *
The xargs command.
Input and Output Redirection Overview in AIX 5L Version 5.2 System User's Guide: Operating System and Devices.
Shells Overview in AIX 5L Version 5.2 System User's Guide: Operating System and Devices.