+1(978)310-4246 credencewriters@gmail.com
  

Description

12/2/21, 11:54 AM
Shell Assignment 3
Shell Assignment 3
Start Assignment
Due Sunday by 11:59pm
Points 100
Submitting a file upload
Available Aug 23 at 12am – Dec 9 at 11:59pm 4 months
File Types zip
Assignment #3: Unix shell with redirects and pipes
The purpose of this assignment is to learn to develop multi-process programs. You are expected to
extend the myshell.c program and add pipelines and I/O redirections. In particular, your shell program
should recognize the following:
1. > – Redirect standard output from a command to a file. Note: if the file already exists, it will be erased
and overwritten without warning. For example,
COP4338$ ls > 1
COP4338$ sort myshell.c > 2
Note that you’re not supposed to implement the Unix commands (ls, sort, …). You do need to
implement the shell that invoke these commands and you need to “wire” up the standard input and
output so that they “chain” up as expected.
2. >> – Append standard output from a command to a file if the file exists; if the file does not exist,
create one. For example,
COP4338$ sort myshell.c >> 1
COP4338$ echo “Add A Line” >> 1
3. < - Redirect the standard input to be from a file, rather than the keyboard. For example, COP4338$ sort < myshell.c COP4338$ sort < myshell.c > 1
COP4338$ sort > 1 < myshell.c The second and third commands are the same: the sort program reads the file named myshell.c as standard input, sorts it, and then writes to file named 1. 4. | - Pass the standard output of one command to another for further processing. For example, COP4338$ ls | sort COP4338$ sort < myshell.c | grep main | cat > output
https://fiu.instructure.com/courses/120412/assignments/1444759
1/6
12/2/21, 11:54 AM
Shell Assignment 3
Make sure you have your parent process fork the children and ‘wire’ them up using pipes accordingly.
There will be spaces separating tokens in the command line. Your program should be able to run with all
the Unix commands as expected. Don’t assume your program will only be tested by the above
commands. Also, there could be more than two commands chained by pipes, like the second example
above.
Your program needs to provide necessary sanity-check from the user input. Prompt meaningful errors
accordingly as what you’d experience with your shell.
Hint: use strtok() functions to separate the tokens and use strstr() to locate sub-strings.
Submit a zip file FirstnameLastnameA3.zip (of course, you’d use your real name here). You should place
the source code and the Makefile in the directory. One should be able to create the executable called
myshell by simply ‘make’. The Makefile should also contain a ‘clean’ target for cleaning up the directory
(removing all temporary files, object files and executable files). Make sure you don’t include intermediate
files: *.o, executables, *~, etc., in your submission. (There’ll be a penalty for including unnecessary
intermediate files).
Please make sure you submit homework before the deadline. Extensions cannot be given for the final
program.
If the program does not compile and do something useful when it runs it will not earn any credit.
Shell Assignment 3 Rubric CMR Fall 2021
https://fiu.instructure.com/courses/120412/assignments/1444759
2/6
12/2/21, 11:54 AM
Shell Assignment 3
Criteria
Zip File named FirstNameLastNameA3.zip
using the student name
Ratings
2 pts
Meets
1 pts
Minor Errors
0 pts
Needs
Requirements
Submission file has extra
spaces, underscores or
Improvement
characters in the name
file not as
specified
Submission file
named exactly
as specified
Makefile named Makefile
1 pts
Minor Errors
0 pts
Needs
Requirements
Makefile spelled
with a lower case m
Improvement
as in makefile
included
correctly with proper
capitalization
Make file should include a clean target
which removes all .o files at a minimum.
3 pts
Minor Errors
0 pts
Needs
Requirements
Improvement
Typing make at
Typing make at the
command line
the command
line creates an
executable file
creates an
executable named
anything close to
the command
line creates an
executable
named myshell
myshell
named anything
else
Typing make at
2 pts
Meets
1 pts
Minor Errors
0 pts
Needs
Requirements
Typing make clean
does not remove
Improvement
exactly what is
expected
clean target
or it does not
work
works correctly is
included in the
Makefile.
There is no
3 pts
Meets
1 pts
Minor Errors
0 pts
Needs
Requirements
There were 1-2
warnings when
Improvement
compiling on
ocelot
more warnings
when compiling on
ocelot
There were no
warnings when
compiling on
ocelot
https://fiu.instructure.com/courses/120412/assignments/1444759
No Makefile
5 pts
Meets
A clean target that
There should be no warnings during
compile
Submission
2 pts
Meets
Makefile named
Typing make at the command line should
create executable named myshell
Pts
Program has 3 or
2 pts
2 pts
5 pts
2 pts
3 pts
3/6
12/2/21, 11:54 AM
Shell Assignment 3
Criteria
Ratings
Pts
Only your source files and the Makefile
should be submitted. Extracting all files
3 pts
Meets
1 pts
Minor Errors
0 pts
Needs
from your zip file should show only those
listed files
Requirements
Improvement
Only the requested
Other files or
folders were
files were included
included
properly
submitted.
Zip file was not
Comment at the top of the file needs
student name, Panther ID, affirmation of
4 pts
Meets
2 pts
Minor Errors
0 pts
Needs Improvement
originality and a program description.
Requirements
Header
included most
The header at the top
was missing most
included all
required
elements.
required
elements.
elements or was not
included.
Program should have consistent
indentation
3 pts
Meets
2 pts
Minor Errors
0 pts
Needs
Consistent indentation with curly braces
lined up in either of the two standard
Requirements
Improvement
Indentation is
Indentation not
consistent in one
formats. They can be lined up right above
each other or the opening curly brace can
be on the right end of the line above with
consistent
or two places
consistent in three
or more places
Header
Indentation not
3 pts
4 pts
3 pts
the block begins
Program should have good comments
throughout the body and describing each
function
Code should be readable with good
variable and function names
3 pts
Meets Requirements
2 pts
Minor Errors
0 pts
Needs
Good comments are
included throughout the
Some
comments
Improvement
program in the body of the
code and at the top of each
function
are included,
but more are
needed
are included
3 pts
Meets
2 pts
Minor Errors
0 pts
Needs
Requirements
Variable and
function names
Improvement
have minor
problems
function names
are not good
Variable and
function names
are well thought
out
https://fiu.instructure.com/courses/120412/assignments/1444759
No comments
Variable and
3 pts
3 pts
4/6
12/2/21, 11:54 AM
Shell Assignment 3
Criteria
No use of break or continue statements
except in a switch
Ratings
Pts
10 pts
Meets
0 pts
Minor Errors
0 pts
Needs
Requirements
Improvement
There were no break
A break or a
continue statement
or a continue
statements other
than breaks in a
was used in the
program other than
in a switch
switch statement
statement
N/A
Program must exit with a return code of 0
on success of and error code in other
4 pts
Meets
3 pts
Minor Errors
0 pts
Needs
cases
Requirements
Improvement
Program exits
Program exits
with a 0 on
with a 0 on
success and an
error code for
success, but not
a good error code
on failure
exit with a 0 on
success and an
error code for other
other cases
Prompt is COP4338$
Program does not
4 pts
cases
2 pts
Meets
1 pts
Minor Errors
0 pts
Needs
Requirements
Prompt is close but not
as specified
Improvement
Correct prompt
10 pts
used
Prompt is
2 pts
incorrect
> – Redirect standard output from a
command to a file works. For example: ls
10 pts
Meets
7 pts
Minor Errors
0 pts
Needs
>1
Requirements
Improvement
Redirection
Redirection from
standard output
from standard
output from a
command to a
from a command to
a file has minor
errors
standard output
from a command
to a file does not
file works
Redirection from
10 pts
work
>> – Append standard output from a
command to a file if the file exists; if the
10 pts
Meets
7 pts
Minor Errors
0 pts
Needs
file does not exist, create one. For
example: ls >> 1 and ls >> 2
Requirements
Improvement
Append from
Append from
standard output
standard output
from a
command to a
from a command to
a file works with
minor errors
standard output
from a command
to a file does not
file works
whether the file
whether the file
exists or not
work whether the
file exists or not
Append from
10 pts
exists or not
https://fiu.instructure.com/courses/120412/assignments/1444759
5/6
12/2/21, 11:54 AM
Shell Assignment 3
Criteria
Ratings
Pts
< - Redirect the standard input to be from a file, rather than the keyboard. For 10 pts Meets 7 pts Minor Errors 0 pts Needs example: cat < 1 Requirements Redirection of standard input to Improvement standard input to from a file works from a file works with minor errors standard input to from a file does not work | - Pass the standard output of one command to another for further 10 pts Meets 7 pts Minor Errors 0 pts Needs processing. For example: cat Makefile | grep cc Requirements Improvement Piping Piping standard output of one standard output of one command to command to another works with minor errors output of one command to another does not Redirection of another work Redirection of Piping standard 10 pts work Multiple pipes work on one command line. For example: cat myshell .c | sort | grep 14 pts Meets 10 pts Minor Errors 0 pts Needs main Requirements Improvement Multiple pipes work Multiple pipes work on the same on the same command line with stdin and stdout command line with stdin and stdout used with minor errors work on the same command line used properly 10 pts Multiple pipes 14 pts does not work Total Points: 100 https://fiu.instructure.com/courses/120412/assignments/1444759 6/6 Purchase answer to see full attachment

  
error: Content is protected !!