PHP_Shell
[ class tree: PHP_Shell ] [ index: PHP_Shell ] [ all elements ]

Source for file php-shell-cmd.php

Documentation is available at php-shell-cmd.php

  1. <?php
  2.  
  3. require_once "PHP/Shell.php";
  4.     
  5. $__shell = new PHP_Shell();
  6.  
  7. $f = <<<EOF
  8. PHP-Barebone-Shell - Version %s%s
  9. (c) 2006, Jan Kneschke <jan@kneschke.de>
  10.  
  11. >> use '?' to open the inline help 
  12.  
  13. EOF;
  14.  
  15. printf($f
  16.     $__shell->getVersion()
  17.     $__shell->hasReadline(', with readline() support' '');
  18. unset($f);
  19.  
  20. while($__shell->input()) {
  21.     try {
  22.         if ($__shell->parse(== 0{
  23.             ## we have a full command, execute it
  24.  
  25.             $__shell_retval = eval($__shell->getCode())
  26.             if (isset($__shell_retval)) {
  27.                 var_export($__shell_retval);
  28.             }
  29.             ## cleanup the variable namespace
  30.             unset($__shell_retval);
  31.             $__shell->resetCode();
  32.         }
  33.     catch(Exception $__shell_exception{
  34.         print $__shell_exception->getMessage();
  35.         
  36.         $__shell->resetCode();
  37.  
  38.         ## cleanup the variable namespace
  39.         unset($__shell_exception);
  40.     }
  41. }

Documentation generated on Mon, 11 Mar 2019 14:40:33 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.