command shell


Version 2.6 released on June 21, 2013.

Version 2.5 released on July 30, 2012.

Version 2.4 released on June 30, 2011. Introduced configuration script.

Version 2.3 released on April 1, 2011.

Version 2.2 released on January 24, 2011.

Version 2.1 released on September 5, 2010.

Version 2.0 released on May 26, 2010. You will need to make changes to if you are upgrading from version 1.x. See the README file for details.




This script provides a command shell to which you can add your own commands. Initial customization of the script is made using Make additional customizations by editing the and files that are generated by

Detailed instructions for customizing the script and documentation of support routines appears in cs.pdf and

I encourage you to make all your customizations in the and files unless the main script needs fixing or improvements. In the latter case, please send those changes to me. Please also send me any generic changes you make to and such as new utility routines that might be useful to all script editors.

The basic script provides three or four modes of operation:

main this is the mode to which you will typically add your own commands
systemexecute operating system commands (via system function)
perl evaluate perl expressions
cgi (optional) execute commands on a server

The cgi mode is only enabled after one or more calls to addCGI. (See for more information.) This mode communicates with scripts on a remote server. These scripts appear in the server directory of the distribution. Install the scripts on the server and be sure they are executable by the web server.

CGI mode is derived from version 0.17a of CGI-Shell by Michael Pradel. As of this writing, CGI-Shell is up to version 0.21. Feel free to upgrade the script to work with the latest version; if you do, please send those changes to me.


Here is a sample session in a version of without any customization:

main> help
e!command    Execute a sample <command>
!command     Execute a system <command>
p!statement  Execute a Perl <statement>

main         Process in sample mode
system       Process in system command mode
perl         Process in Perl mode

edit file    Edit <file> with emacs
reload       Reload this program
quit         Exit this program
main> help system
System mode and the ! prefix allow you to execute system commands.
main> !ls
GPL  README  server
main> help perl
Perl mode and the p! prefix allow you to execute Perl expressions.
main> p!$ENV{EDITOR}
main> p!@modes
main> exit

Send me reports of any errors or suggestions you have about my Perl scripts.

The code described on this page is Copyright 2004-2013 Tony Lewis <>.

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see <>.