Here's a simple command ... I know it by heart ... that I use to syntax check all of the Perl programs in a directory:
Code:
find . -name \*.pm | xargs -I{} perl -wc '{}' \;
Notice the use of the "
-I{}" construct, and the subsequent use of that placeholder in the command being executed. Also notice the "
\;" construct: both are essential.
Use
man xargs for an explanation of this voodoo.
Tip: It could be useful to include the word
echo (in front of the word
perl in the above example) so that, instead of
executing the commands, it simply
prints (echoes...) them to the console. (The "command to be executed" becomes
echo.) This will let you
see exactly what is going on... exactly what commands would have been executed.