'lines', 'w' => 'words', 'c' => 'characters');
// defaults
$count = 'l';
$path = './';
$regex = '.*\.(class|inc|php)';
if (isset($_POST['go'])) {
$count = isset($_POST['count']) && isset($countables[$_POST['count']]) ? $_POST['count'] : $count;
$path = empty($_POST['path']) ? $path : $_POST['path'];
$regex = str_replace('"', '\"', (empty($_POST['regex']) ? $regex : $_POST['regex']));
$cmd = 'wc -'.$count.' `find '.realpath($path).' -regextype posix-egrep -regex "'.$regex.'" -print` | tail -1 | awk \'{print $1}\'';
$out = shell_exec($cmd);
echo ''.$out.' '.$countables[$count].'
';
echo ''.$cmd.'
';
}
?>