What Is the Purpose of the Command Interpreter?


A command interpreter is a computer program that accepts textual commands interactively, from the keyboard; or reads them from a file, and executes them. The purpose of a command interpreter is therefore to execute commands, such as setting dynamic variables that contain information about the environment of the system, known as “environment variables,” or to load and execute other files.


  • Command interpreters for the Unix operating system are known as shells. The Unix shell is the highest of several layers of interaction that take place between the computer hardware and the user. The shell manages the interaction between the user and the applications and command, which, in turn, interact with a lower layer, known as the kernel. The kernel is a separate program that runs on the computer hardware and manages all interactions with it.

Shell Scripts

  • Unix shells have their own grammatical rules, or syntax, and control structures, which means that shell commands can be used, in combination, to automate repetitive tasks. To create a Unix shell script -- which you can run over and over again, just like any other program -- you simply need to create a text file and store the sequence of commands that you want to execute. The only provisos are that you must identify the text file as a shell script by including the name of the command interpreter -- “#!/bin/sh” for the standard Bourne shell -- on the first line of the line and make the file executable by running the command “chmod +x {filename}”.


  • Under the Windows operating system, the command interpreter is known as the command shell. You can start the command shell by selecting “Start,” “All Programs,” “Accessories,” “Command Prompt” or by selecting “Start,” “Run,” typing “cmd.exe” into the text box and clicking “OK.” By default, the Windows command shell starts in interactive mode and provides a character-based interface, by means of which you can enter commands. Commands can be modified by one or more arguments, or command switches -- which always start with the slash (/) character -- separated by spaces.

Script Files

  • If you enter a command that is the name of a script file, the Windows command shell switches from interactive mode to script mode and begins executing the commands in the script file one by one. Once the Windows command shell has executed the last command in the script file, it switches back to interactive mode, displays a command prompt and waits for keyboard input.

Related Searches


Promoted By Zergnet


Related Searches

Check It Out

Geek Vs Geek: Robot battles, hoverboard drag race, and more

Is DIY in your DNA? Become part of our maker community.
Submit Your Work!