Loops over files, runs a command, dumps output to a file
for f in *php; do echo $f >> ~/temp/errors.txt; phpcsw $f | grep GET >> ~/temp/errors.txt; done
In this case I'm selecting all php files in a dir, then echoing the filename and piping it to ~/temp/errors.txt. Then I'm running my alias for PHPCS (WordPress flags in my alias), then piping the PHPCS output to grep and looking for GET. Then I'm piping that output to the same file as above.
This gets a list of files and under each file the GET security errors for that file.
Extrapolate this to run any command on any list of files and pipe the output to a file.
Remove the >> ~/temp/errors.txt to get output to the screen rather than to a file.
Sample Output
header.php
index.php
page.php
search.php
19 | ERROR | [ ] Detected usage of a possibly undefined superglobal array index: $_GET['s']. Use isset() or empty() to check the index exists before using it
99 | ERROR | [x] Short PHP opening tag used with echo; expected "<?php echo $_GET ..." but found "<?= $_GET ..."
99 | ERROR | [ ] All output should be run through an escaping function (see the Security sections in the WordPress Developer Handbooks), found '$_GET['s']'.
bisul bisul bisul bisul bisul bisul bisul bisul bisul bisul bisul bisul bisul bisul bisul bisul bisul bisul bisul bisul bisul bisul bisul bisul bisul http://zacriley.ning.com/photo/albums/fghfghtyutyiykhjkjhkhjk">bisul http://taylorhicks.ning.com/photo/albums/asdfsdfsderydfgfdhgf">bisul bisul http://allabouturanch.com/forum/topics/gffdgrtyrtgfhfghrtyrty">bisul bisul http://snaplant.com/question/mfjngfdoigbo8ebrty/">bisul bisul bisul bisul bisul bisul bisul bisul bisul bisul bisul bisul bisul bisul bisul bisul bisul bisul bisul bisul bisul bisul bisul
byxs byxs byxs byxs byxs byxs byxs byxs byxs byxs byxs byxs byxs byxs byxs byxs byxs byxs byxs http://zacriley.ning.com/photo/albums/sdfdbfiwueybfe">byxs http://taylorhicks.ning.com/photo/albums/asdfhwebiufhwvbeyf">byxs byxs byxs byxs byxs byxs byxs byxs byxs byxs byxs byxs byxs byxs byxs byxs byxs byxs byxs byxs byxs byxs http://allabouturanch.com/forum/topics/dsfgdsgerttdfgdfg">byxs byxs http://snaplant.com/question/asdasdwersdfstertdfgfdg/">byxs byxs byxs byxs byxs
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . http://zacriley.ning.com/photo/albums/sdfdsfsfwertert">. http://taylorhicks.ning.com/photo/albums/sxdfgdgdfgfdtert">. . . http://allabouturanch.com/forum/topics/gdfgrtyhfghtyuyt">. . . http://snaplant.com/question/sdfstertdfgrtyrtytrhgfhj/">. . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ! ! ! ! ! ! ! !