APPLY(1) UNIX Reference Manual APPLY(1) NNAAMMEE aappppllyy - apply a command to a set of arguments SSYYNNOOPPSSIISS aappppllyy [--aacc] [--nn] _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. Normally ar- guments are chosen singly; the optional number --nn specifies 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 sequences 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'_t_h follow- ing 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. The character `%' may be changed by the --aa option. aappppllyy checks the environment variable SHELL to find out which shell to use. 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) HHIISSTTOORRYY AAppppllyy appeared in 4.2BSD. 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.