Question: In this assignment, you will write a shell that allows the user to interactively execute Unix programs. Your shell, called New Shell (newsh), reads commands

In this assignment, you will write a shell that allows the user to interactively execute Unix programs. Your shell, called New Shell (newsh), reads commands typed by the user and then executes them. It also allows users to set variables that can be used in subsequent commands. You may write newsh in C or C++.

newsh is somewhat similar to existing shells such as csh, bash, ksh, tcsh and zsh. However, it lacks many of the features of those shells. Its syntax and command set may be different. newsh takes commands from standard input and directs all its output to standard output. Like other shells, newsh accepts both built-in commands and program-control commands. Commands are constructed out of tokens. A token is string without any space. Tokens are subject to variable substitution, as described below. There can be any amount of empty space before and after tokens. The % symbol introduces a comment, which continues to the end of the line. You may assume that % never appears within a token. newsh ignores all characters in a comment. If a line is empty (or just spaces) except for a comment, it is a valid command that has no effect.

Build-in Commands newsh supports following build-in commands:

set variable name

cd directory name

bp

quit

program control functions

cmd param*

cmd param* &

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!