views:

202

answers:

1

I know this is simple but I just cant figure it out.

I have a bunch of files output by "svn st" that I want php to do a syntax check on the command line.

This outputs the list of files: svn st | awk '{print $2}'

And this checks a php script: php -l somefile.php

But this, or variants of, doesn't work: svn st | php -l '{print $2}'

Any ideas? Thanks!

+4  A: 

Use xargs:

 svn st | awk '{print $2}' | xargs -L 1 php -l

The xargs -L 1 command reads items from standard input, one per line, and runs the given command for each item separately. See the xargs(1) man page for more info.

Ville Laurikari
Awesome man! Thanks!!!