Re: Using CLI as a shell

From: Date: Mon, 03 Feb 2003 18:58:54 +0000
Subject: Re: Using CLI as a shell
References: 1 2  Groups: php.dev 
Request: Send a blank email to php-dev+get-93958@lists.php.net to get a copy of this message
At 19:37 03.02.2003, Derick Rethans wrote:
On Mon, 3 Feb 2003, Marcus [iso-8859-1] Börger wrote: After adding -B, -F, -R and -E which will hopefully liked by the rest of development team so that the stuff need not to be removed. Perhaps start by explaining what they do?
First simply use "php -h" but i am also thinking about adding a man page. Ok an example even though i do not know if it is a good one because you may find better solutions but it shows how it works. Type the following shell command at the php source directory: find . -name '*.c' -o -name '*.h' | php -B '$l=0;' -R '$f=count(file($argn)); echo "$argn($n)\n";$l+=$f;' -E 'echo "Files: $argi, Lines: $l\n";' This one uses find to search for all .c and .h files in the current directory. At startup it initialises $l to zero. For every line reported by find (every file) the statement in -R gets executed. That statement counts the lines in the current file and shows its name and linecount. After all files are processed the statement in -E show the result (line count of all files). I hope the above example points out the idea.
I (or better a friend of mine) had another idea. Here comes: Why not use CLI as a shell? I'd say adding a command line switch say -S which parses and executes every line that is entered. What do you think? PHP is not a shell, and we have interactive mode for that already. I really don't see the use for this.
Just an idea to think about.... 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. regards marcus

« previous php.dev (#93958) next »