i want help about the Simulate a Linux/UNIX shell, called MASH (for MiniAture SHell) in the C. plz read the the my problem and send the best solution of my problem as soon as possible.
After the completion of this assignment you’ll be able to:
Simulate a Linux/UNIX shell, called MASH (for MiniAture SHell) in the C language.
Description and Specifications:
The shell should have a prompt. It should accept commands, interpret them,
execute them, and then redisplay the prompt for the next command. The shell
should terminate on receiving EOF <Ctrl-D>. It is not acceptable for it to
terminate upon receiving a signal such as SIGINT <Ctrl-C>.
The shell will implement six intrinsic functions:
cp copy a file
mv move a file
rm remove a file
cd ability to change to designated directory
mkdir for creating directory
rmdir for removing directory
By intrinsic, I mean built-in, i.e., the shell will have these functions built into it as
a process. This means that you will have to write the code for these commands
and not use the fork() and exec() system calls or the library function system().
Maintain a history list of previously executed commands and allow the user to
access the commands in the history list with the “! operator.
1. Numerical Usage
!N means execution of the command which is N commands before the last
command such as !1 for executing the second to the last command. All the
commands have to be stored on disk upon exit. Assume that your shell will
serve last 100 commands i.e. !101 shall throw an error to the user.
2. Alphabetical Usage
!g would mean executing the last command that started with the letter g, such
as gcc assignment3.c.
You will use the fork() and execlp() or execvp() system calls to enable your
shell to support the above features unless specified otherwise. All other commands
should be passed to some parent shell and executed. This is done with the library
call system(). So, here is the list again:
. Ignore SIGINT <Ctrl-C>.
. Show your custom prompt.
. Get input and terminate on EOF <Ctrl-D>.
. Carry out (i.e., decode and execute) commands.
. Implement a simple parser to recognize "cp", "mv", "rm", and "cd" as
the first words of any set of input arguments. If recognized, carry out
the appropriate command by using your OWN code and NOT by using
the fork() and execlp() calls, or calling the library all system().
. If the first letter of a command is ! or the first letter of the second
word is |, use the fork() and execlp() system calls to implement the
. For all other commands, use the library call system() with the whole
input line as its argument.
. You MUST use the read() system call for reading input from the
You have to encode the functionality so that to test MASH automatically, it can be
by using the following input parameters:
MASH -f input_file
[Note: MASH should terminate at the end of the input script-file.]
<< moderator edit: removed email address >>