Create a new process and execute the command in new process

Assignment Help Computer Engineering
Reference no: EM133540434

Assignment: Programming Project

Problem Statement

You will be writing a program that presents its user with a shell in which they can type commands and see their results. This shell should support changing directories, running commands, redirecting input and/or output, and piping output from one command to the input of another command.

Problem Details

You are to take the provided Command class (which can read commands from the keyboard) and use it to repeatedly read in and process commands until the user types in "exit" as a command.

With the exception of the "cd" and "exit" commands, each command should create a new process and execute the command in the new process. Some other details:

I. The "exit" command should cause your shell program to end. printing a message indicating such.

II. The "cd" command should used the chdir() system call to change directories in the current shell. The chdir function call takes one parameter, namely a string (c-style character array/ pointer version) representing the name of the directory to change into.

III. Other commands should be executed using an execvp() call.

IV. A command with an input redirect should use the contents of the specified input file as if it is standard input. For example,

wc -l < data.txt

Will count the number of lines (the wc - l command) found in the file data.txt and display that number on standard output (i.e. on the console.)

V. a command with an output redirect should use the contents of the specified output file as if it is standard output. For example,

wc -l < data.txt > output.txt

will count the number of lines (the wc - l command) found in the file data.txt and output the result in the file output.txt . Note that this will overwrite the contents of the file output.txt. Also note that you can do file output redirection without file input redirection.

VI. A command specified to run in the background (by adding an &) means that the shell should immediately allow another command to be entered at a new command prompt. When a backgrounded program completes, a summary including the name of the command and its PID should be printed.

VII. On the other hand, a command entered without an & indicating background processing should wait for the associated command to complete before prompting the user to enter another command.

VIII. A command with a pipe out ("|") should redirect its output to a pipe. This pipe should then be used as the input for the next command read. For example,
cat somefile.txt | sort

should output the file somefile.txt (i.e. cat somefile.txt) into a pipe (not on the screen) and then another command (i.e. sort) uses the pipe for its input (and displays its output on the screen, since there is no pipe out for the sort command or any output file redirection for the sort command.)

Remember that upon exit your shell program should print a message indicating that your shell has completed.

Reference no: EM133540434

Questions Cloud

Discuss each component and specific information to included : Discuss each component and the specific information to be included within each section of the policy.
Discuss the implications of your research findings : Develop a 3 to 4 pages paper detailing problem addressed in the research paper and the proposed solution. Discuss the implications of your research findings.
Create a new ssis project : Create a new SSIS project. Create a new database called ETL_Data in SQL Server. Create an SSIS package for each of the tasks.
Prepare a report by interpreting the visualisations : Finish designing your visualisations, then prepare a report by interpreting the visualisations and integrating with theory from this subject
Create a new process and execute the command in new process : CSC 35500- With the exception of the cd and exit commands, each command should create a new process and execute the command in the new process.
Make recommendations on customer segmentation and targeting : Make recommendations on customer segmentation, targeting and product positioning; using the marketing mix to engage with the target segment; pricing tactics
What bundaberg can do to acquire new customers : What Bundaberg should do with customer relationship management and What Bundaberg can do to acquire new customers
What is thefirst packets destination port number : IS 3413- Examine the details in the first packet. What is thefirst packet's destination port number? What is the significance, if any, of this port number?
Describe how to identify and evaluate project development : SRM750 Built Environment Professional Practice, Deakin University - Describe how to identify and evaluate project development options in response to a project

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd