hi
please can any one help me in my shell project
like this :
Develop a c program which serve as s shell interface that accepts user command and then executes each command in separate process. The shell interface provides a command prompt ( sh> ) after which next command is entered .
#define TRUE 1
while(TRUE){ //repeat forever
type_prompt(); //display prompt on the screen
read_command (command, parameters); //read input from terminal
if(fork()!=0){ //fork off child process
waitpid(‐1, &status, 0); //wait for child to exit
}
else{
execve(command, parameters, 0); //execute command
}
}
Write a shell that is similar to the above code snippet, but contains enough code that it actually works so you can test it. You may also add some features such as redirection of in input and output, pipes, and background jobs.
If the user entered “& “ at the end of his/her command, then the process (command) will be executed in the background and the shell WILL Not WAIT It To Terminate.
You can experience background process yourself by trying the following command on bash shell.
> kwrite
The kwrite application will be run, and the shell prompt will not prompt a user until you terminate kwrite. On the contrary, if you tried the following command, the prompt will return to the user to accept other commands while kwrite (child process) is running in the background!
please