APPLY(1) BSD Reference Manual APPLY(1) NNAAMMEE aappppllyy - apply a command to a set of arguments SSYYNNOOPPSSIISS aappppllyy [--aa_c] [--_n] _c_o_m_m_a_n_d _a_r_g_s _._._. DDEESSCCRRIIPPTTIIOONN AAppppllyy runs the named _c_o_m_m_a_n_d on each argument _a_r_g in turn. Options available are: --_n Normally arguments are chosen singly; the optional number --nn speci- fies the number of arguments to be passed to _c_o_m_m_a_n_d. If --nn is zero, _c_o_m_m_a_n_d is run without arguments once for each _a_r_g. Character se- quences of the form %_d in _c_o_m_m_a_n_d, where _d is a digit from 1 to 9, are replaced by the _d'th following unused _a_r_g. If any such sequences occur, --nn is ignored, and the number of arguments passed to _c_o_m_m_a_n_d is the maximum value of _d in _c_o_m_m_a_n_d. --aa_c The character `%' may be changed by the --aa option. EENNVVIIRROONNMMEENNTT The following environment variable is used by aappppllyy: SHELL Pathname of shell to use. If this option is not defined, a default shell is used. EEXXAAMMPPLLEESS apply echo a* is similar to ls(1); apply -2 cmp a1 b1 a2 b2 ... compares the `a' files to the `b' files; apply -0 who 1 2 3 4 5 runs who(1) 5 times; and apply 'ln %1 /usr/joe' * links all files in the current directory to the directory _/_u_s_r_/_j_o_e. SSEEEE AALLSSOO sh(1) AAUUTTHHOORR Rob Pike BBUUGGSS Shell metacharacters in _c_o_m_m_a_n_d may have bizarre effects; it is best to enclose complicated commands in single quotes (`'). There is no way to pass a literal `%2' if `%' is the argument expansion character. HHIISSTTOORRYY The aappppllyy command appeared in 4.2BSD. 4.2 Berkeley Distribution June 6, 1993 1