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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started