RE: [PHP-DEV] Using CLI as a shell
| From: | David Sklar | Date: | Mon, 03 Feb 2003 19:56:51 +0000 |
| Subject: | RE: [PHP-DEV] Using CLI as a shell | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-93963@lists.php.net to get a copy of this message | ||
> > > There is a difference between interactive mode and this idea. The
> > > idea was to execute every single line. So if you type 'echo "Hello\n";
> > > and press enter "Hello" should be displayed.
> >
> > i like this idea, so i no longer have to type echo "Hello" on my bash
> prompt
> > :)
>
> At least with this (presumably) Python style shell you could use
> readline to
> prevent you typing echo "Hello" twice (as opposed to current php -a). :)
The "Command Shell" program in Recipe 20.9 of the PHP Cookbook uses
readline() to implement a PHP shell-style prompt, where each line is
executed as you type it. It also uses readline_completion_function() to
provide tab-completion for function names.
You can download it in the archive of code from the book at:
--> http://examples.oreilly.com/phpckbk/
-dave