Answered step by step
Verified Expert Solution
Question
1 Approved Answer
In your first assignment for the Operating Systems course, you will develop a simple shell by implementing a basic REPL ( Read , Eval, Print,
In your first assignment for the Operating Systems course, you will develop a simple shell by implementing a basic REPL Read Eval, Print, Loop in C Your shell should support the following commands:
cd change directory
cd
pwd print working directory
pwd
exit exit the shell
exit
help display help
help
A sample output would be:
myshell help
cd change directory
pwd print working directory
exit exit the shell
help display help
mkdir create a directory
rmdir remove a directory
ls list files in a directory
cp copy a file
mv move a file
rm remove a file
mkdir create a directory
mkdir
rmdir remove a directory
rmdir
ls list files in a directory
ls
A sample output would be:
myshell ls
file file file
You can delimit the files with a space, or a tab t
cp copy a file
cp
mv move a file
mv
rm remove a file
rm
Submission Guidelines
You should submit a single zip file containing the following:
README.md a markdown file containing a brief description of your implementation, similar to a manpage
shell.c the source code for your shell
Makefile a makefile to build your shell's binary
You should be targeting the gcc compiler, with a minimum ISO C standard. You can use the following command to ensure that your code compiles with
the correct flags and standards:
gcc stdcpedantic shell.c o shell
Your Makefile should have the following targets:
all builds the shell
clean removes the shell binary
run runs the shell
shell.c
#include
#include
#include
void cdchar path;
int main
char input;
while
printfmyshell;
fgetsinput stdin;
inputstrcspninput
;
char command strtokinput;
char arg strtokNULL;
You can extend this code to support more arguments
if strcmpcommandcd
cdarg;
You will need to extend this code to support other commands
else
printfUnknown command: s
command;
return ;
void cdchar path
Placeholder for cd implementation
The remaining functions can be implemented here
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