Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this lab, you will write a simple shell by your own. In this shell, it takes an input command, and then executes it. Your

In this lab, you will write a simple shell by your own. In this shell, it takes an input command, and then executes it. Your shell should implement the followings:

Take external commands, such as, ls, emacs and so on.

Take internal commands

exit: terminate the shell.

jobs: list all jobs in the format: , in the order of creation

help: help information of your shell.

Descriptions:

The input to the shell is a sequence of lines. The shell must correctly handle lines of up to 100 characters. If a line containing more than 100 characters is submitted to the shell, it should print some kind of error message and truncate it to 100 characters.

Each line consists of tokens. Tokens are separated by one or more spaces. A line may contain as many tokens as can fit into 100 characters.

Words consist of the characters AZ, az, 09, dash, dot, forward slash, and underscore. If a word in a line of input to the shell contains any character not in this set, then the shell should print an error message and then ignore the rest.

Lines of input are divided into token groups. Each token group will result in the shell forking a new process and then executing a program.

Every token group must begin with a word that is called the command. The words immediately following a command are called arguments and each argument belongs to the command it most closely follows. The order of arguments matters, and they are numbered from left to right, starting at one.

System Calls:

fork()

execvp() or execlp()

wait()

exit()

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data And Databases

Authors: Jeff Mapua

1st Edition

1978502257, 978-1978502253

More Books

Students also viewed these Databases questions

Question

3. The group or the instructor appoints a leader for each group.

Answered: 1 week ago

Question

Where those not participating, encouraged to participate?

Answered: 1 week ago

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago