Study On Command Line Interpreter System Software Computer Science Essay

Published: Last Edited:

This essay has been submitted by a student. This is not an example of the work written by our professional essay writers.

Definition: If we talk about the command line interpreter it is any program that allows us to enter the commands and executing these commands on our operating system.

Considering Windows OS, the primary command line interpreter is Command Prompt. The windows Power Shell is a more advanced command line interpreter which is available alongside Command Prompt in more recent versions of Windows.

Also Known As: CLI, command language interpreter, command line shell, command line interface, command interpreter

A system program that accepts user commands and converts them into the machine commands required by the operating system or some other control program or application. COMMAND.COM was the command processor that accompanied DOS and Windows 95/98. Subsequent Windows versions replaced COMMAND.COM with CMD.EXE. In Unix/Linux, command processors are called "shells"

The main ideas of CLIP are to support interpreter based teaching and to give students better and clear error messages in their native language. In addition to these, it should be possible to integrate a visualization module with the interpreter. This requirement has its roots in our visualization tool VIP (Virtanenet al. 2005), since we are not willing to maintain two separate interpreters.

CLIP can be used in two modes, an interactive mode or a single mode.

Interactive mode-Users write commands directly for the interpreter as

they would be written inside the main function. The user can still structs and functions normally.

Single Mode- The user can give CLIP a single which is then interpreted and executed like any script. The command line interface of CLIP can beseen in Figure

Command-line interpreters as user interfaces

Command-line interpreters allow users to issue various commands in a very efficient (and often terse) way. This requires the user to know the names of the commands and their parameters, and the syntax of the language that is interpreted.

Diffrerent Command Line Interpreter are :




(iv)Java Command Line Interpreter

(v)php Command Line Interpreter

(i)Perl: In modern Unix programming environment Perl can be used as AWK replacement even in simple scripts. Recently Perl became a standard, installed by default in all major Unixes including AIX, HP-UX, Linux and Solaris. It is usually available in /usr/bin.

Default availability dramatically changed role of Perl in Unix system scripting and routine text processing. For most administrators it is much easier to use Perl that any of the older alternatives. The main consideration here is the power of the language and availability of a very good, built-in debugger. Neither bash nor AWK has built-in debugger installed by default. And that alone tips the scales in Perl favor, as each administrator has a lot of things to do to spend time guessing where he made mistake using multiple echo/print statements.

That's why Perl is gradually displacing older Unix utilities such as cut, sed, wc,and, of course, AWK. Often you can replace quite complex set of pipe stages that use classic UNIX utilities with one Perl loop. Don't interpret me wrong, pipes are a blessing and extremely powerful tool that each UNIX admins should use to the max, but if you can avoid unnecessary complexity, why stick to old practices.


Perl has many and varied applications, compounded by the availability of many standard and third-party modules.

. Perl is known as one of "the three Ps" (along withPython and PHP), the most popular dynamic languages for writing Web applications. It is also an integral component of the popular LAMPsolution stack for web development. Large projects written in Perl include cPanel, Slash, Bugzilla, RT, TWiki, and Movable Type. Many high-traffic websites use Perl extensively. Examples include,,, Craigslist, IMDb,Livejournal, Slashdotand Ticketmaster.

Perl is often used as a glue language, tying together systems and interfaces that were not specifically designed to interoperate, and for "data munging", that is, converting or processing large amounts of data for tasks such as creating reports. In fact, these strengths are intimately linked. The combination makes Perl a popular all-purpose language for system administrators, particularly because short programs can be entered and run on a single command line.

Perl is also widely used in finance and in bioinformatics, where it is valued for rapid application development and deployment and for its capability to handle large data-se


Perl is implemented as a core interpreter, written in C, together with a large collection of modules, written in Perl and C. The source distribution is, as of 2009, 13.5 MB when packaged in a tar file and compressed. The interpreter is 150,000 lines of C code and compiles to a 1 MB executable on typical machine architectures. Alternatively, the interpreter can be compiled to a link library and embedded in other programs. There are nearly 500 modules in the distribution, comprising 200,000 lines of Perl and an additional 350,000 lines of C code. (Much of the C code in the modules consists of character-encoding tables.)

The interpreter has an object-oriented architecture. All of the elements of the Perl language-scalars, arrays, hashes, coderefs, filehandles-are represented in the interpreter by C structs. Operations on these structs are defined by a large collection of macros, typedefs, and functions; these constitute the Perl C API. The Perl API can be bewildering to the uninitiated, but its entry points follow a consistent naming-scheme, which provides guidance to those who use it.

The life of a Perl interpreter divides broadly into a compile phase and a run phase. In Perl, the phases are the major stages in the interpreter's life-cycle. Each interpreter goes through each phase only once, and the phases follow in a fixed sequence.

(ii)PYTHON: Python is an interpreted, interactive, object-oriented programming language. It is often compared to Tcl, Perl, Scheme or Java.

Python combines remarkable power with very clear syntax. It has modules, classes, exceptions, very high level dynamic data types, and dynamic typing. There are interfaces to many system calls and libraries, as well as to various windowing systems (X11, Motif, Tk, Mac, MFC). New built-in modules are easily written in C or C++. Python is also usable as an extension language for applications that need a programmable interface.

The Python implementation is portable: it runs on many brands of UNIX, on Windows, DOS, OS/2, Mac, Amiga... If your favourite system isn't listed here, it may still be supported, if there's a C compiler for it. Ask around on comp.lang.python -- or just try compiling Python yourself.

The Python implementation is copyrighted but freely usable and distributable, even for commercial use.

The Python interpreter is usually installed as /usr/local/bin/python on those machines where it is available; putting /usr/local/bin in your Unix shell's search path makes it possible to start it by typing the command


to the shell. Since the choice of the directory where the interpreter lives is an installation option, other places are possible; check with your local Python guru or system administrator. (E.g., /usr/local/python is a popular alternative location.)

On Windows machines, the Python installation is usually placed in C:\Python27, though you can change this when you're running the installer. To add this directory to your path, you can type the following command into the command prompt in a DOS box:

set path=%path%;C:\python27


Functions and methods within Python are created through the def command. These are extremely useful when you might otherwise repeat the same piece of code. A typical simple function might appear thus:

def square(x):

return x*x # note, one can also use x**2 for x squared,

# x**3 for x cubed, x**4 for x^4 and so on...

This function takes one input (x) and returns x^2 to whatever called it. So if your code contains the above function, you might access it in the following ways:

print square(9) # prints 81 (9*9)


print square(a) # prints 25 (5*5)

b=square(3) # assigns the value 9 to b (3*3)

c=square(b) # assigns the value 81 to c (b*b)

Functions can be called from within functions:

def to_the_power_of_four(x):

return square(x) * square(x) # gets x^2^2 (i.e. x^4)

A note about comments: If a hash (#) sign is used in the code body (i.e. not part of a print statement) then whatever follows it is a comment. A comment is ignored by the Python interpreter and it is considered good practise to use them to make the code more readable by a human - especially useful when one creates larger pieces of code.

A function does not necessarily need to return a value, nor does it need to receive a value. Look at these two functions:

def say_hello(name):

print "Hello", name

def give_me_a_number():

return 1234


Phantom is a powerful Windows automation scripting language. The Phantom interpreter runs standard ASCII Phantom scripts (syntax similar to C) to interact with Windows common controls. Virtually any number of common or repetitive tasks can be automated. It is also a useful tool for automated testing. The Phantom language has many features, including built-in functions, the ability to add functions and user-defined DLLs, flow control, and script error and log output. In order to use the automation features, you will have to learn the scripting language first in order to create your custom scripts. The download comes with everything including some sample scripts and full documentation.

Phantom is a powerful scripting language used toautomate Graphical User Interfaces (GUIs)

• Used for

- Test Automation

- Process Automation

- Application Performance Analysis

• Three products are provided that support the Phantom


- Phantom Test Driver (PTD)

- Phantom Sidekick

- Phantom Command Line Utility

• Phantom can be customized to support customer needs


• Large built-in GUI automation

function set

• Exception handling

• Full script flow control

• Complex built-in data types

- windows

- bitmaps

- option sets

• User-defined functions

• Intuitive window access


Phantom Uses

• QA Test Automation

- Automate scripted manual test procedures

- Regression testing

- Functional testing

- Performance testing

• Process Automation

- Repetitive manual tasks

- Time consuming tasks

- Process scheduling

• Application Performance Analysis

- Repetitive stress analysis

- Response time analysis

-Load response analysis


(iv) The Java Interpreter

java interprets (executes) Java bytecodes.

java classname <args>

java_g classname <args>


The java command executes Java class files created by a Java compiler, for instance, javac.

The classname argument is the name of the class to be executed. classname must be fully qualified by including its package in the name, for example:

% java java.lang.String

Note that any arguments that appear after classname on the command line are passed to the main method of the class.

java expects the binary representation of the class to be in a file called classname.class which is generated by compiling the corresponding source file with javac. All Java class files end with the filename extension .class which the compiler automatically adds when the class is compiled.classname must contain a main method defined as follows:

class Aclass {

public static void main(String argv[]){

. . .



java executes the main method and then exits unless main creates one or more threads. If any threads are created by main then java doesn't exit until the last thread exits.

When you define your own classes you need to specify their location. Use CLASSPATH to do this. CLASSPATH consists of a colon separated list of directories that specifies the path. For example:




Allows the Java debugger, jdb, to attach itself to this java session. When -debug is specified on the command line java displays a password which must be used when starting the debugging session.

-cs, -checksource

When a compiled class is loaded, this option causes the modification time of the class bytecode file to be compared to that of the class source file. If the source has been modified more recently, it is recompiled and the new class file is loaded.

-classpath path

Specifies the path java uses to look up classes. Overrides the default or the CLASSPATH environment variable if it is set. Directories are separated by colons. Thus the general format for path is:


For example:


-v, -verbose

Causes java to print a message to stdout each time a class file is loaded.


Performs byte-code verification on the class file. Beware however, that java -verify does not perform a full verification in all situations. Any code path that is not actually executed by the interpreter is not verified. Therefore, java -verify cannot be relied upon to certify class files unless all code paths in the class file are actually run.

PHP Command Line Interpreter

PHP has steadily progressed to the stage that command line usage of the PHP.exe is easier than ever before; especially with the new PHP 5 betas. This is most fortunate because it makes testing out little scriptlets of PHP code easier than ever. And with the new OOP and XML capabilities of PHP there are plenty of opportunities to test PHP fast and easily with command line test scripts and even simple batch harnesses that rip through 10 variations on a OOP definition theme. The side benefit ? Users suddenly discover that with regular expressions, great database connectivity, always great file I/O oiperations, easy array manipulation - in short the whole legacy Perl-like and enhanced features, PHP makes a great OS scripting agent.

he simplest use of PHP command line mode is to run a phpfile directly:

php phptest.php

However before you do so it is worthwhile making the following changes to setups in to your running environ:

1)put the folder containing the php.exe on the path. For Windows users this is -

Path = c:\phpfolder;%Path%

2)make a copy of the php.ini file and store it in this directory/folder;

3)make the following changes to the php.ini file:

a- output_buffering=off //in interactive mode buffering stalls output until buffer fill

b- implicit_flush=on // this guarantees output is immediate

c- max_execution_time = 30000 //second of elapsed time the program can run


Selection of the Ist programming language for teaching should be done. However, when facing cruel reality, this cannot always be the case. In this stage it is hard to tell how successful CLIP will be. With the new lecture material and integration of a visualization module, we expect to get a

system in which the learner only uses the properties he or she knows, and in which the visualization will help the students not only to understand the program behaviour but also to debug their code.