BBEdit 7.0.2 allows the use of any shell scripting language in its Unix Filters/Scripts framework. If you are a PHP programmer, and have built PHP 4.3.0 or higher on your machine, you should find installed the new CLI (as opposed to CGI) version of the PHP binary (in /usr/local/bin/php), thereby allowing you to (among other things) easily use PHP scripts in BBEdit's Unix Filters/Scripts.
The following code demonstrates a simple PHP script that will number the lines in a BBEdit window (and illustrates how to read the input from BBEDit):
#!/usr/local/bin/php
<?
$input = file($argv[1]) or die($php_errormsg);
$lineNum = 1;
foreach($input as $line)
{
print($lineNum.": ".$line);
$lineNum++;
}
?>
[robg adds: I don't have the CLI version of PHP here, so I can't test this one...]
•
[6,325 views]

